home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.88.11.sit / 001. Sample / Sample.p < prev    next >
MacBinary  |  1988-11-02  |  30.4 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert ZX81 Sinclair BASIC (image/sinclairBASIC) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Nov 1 20:30:53 1988, modified Tue Nov 1 20:30:53 1988, creator 'MPS ', type ASCII, 30569 bytes "Sample.p" , at 0x77e9 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 70 00 00 00 00 00 00 |..Sample|.p......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 77 69 00 | 00 01 7e 9f 94 15 cd 9f |.....wi.|..~.....|
|00000060| 94 15 cd 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 1d 5f 00 00 |........|....._..|
|00000080| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |{-------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000000d0| 23 0d 23 09 41 70 70 6c | 65 20 4d 61 63 69 6e 74 |#.#.Appl|e Macint|
|000000e0| 6f 73 68 20 44 65 76 65 | 6c 6f 70 65 72 20 54 65 |osh Deve|loper Te|
|000000f0| 63 68 6e 69 63 61 6c 20 | 53 75 70 70 6f 72 74 0d |chnical |Support.|
|00000100| 23 0d 23 09 4d 75 6c 74 | 69 46 69 6e 64 65 72 2d |#.#.Mult|iFinder-|
|00000110| 41 77 61 72 65 20 53 69 | 6d 70 6c 65 20 53 61 6d |Aware Si|mple Sam|
|00000120| 70 6c 65 20 41 70 70 6c | 69 63 61 74 69 6f 6e 0d |ple Appl|ication.|
|00000130| 23 0d 23 09 53 61 6d 70 | 6c 65 0d 23 0d 23 09 53 |#.#.Samp|le.#.#.S|
|00000140| 61 6d 70 6c 65 2e 70 09 | 2d 09 50 61 73 63 61 6c |ample.p.|-.Pascal|
|00000150| 20 53 6f 75 72 63 65 0d | 23 0d 23 09 43 6f 70 79 | Source.|#.#.Copy|
|00000160| 72 69 67 68 74 20 a9 20 | 31 39 38 38 20 41 70 70 |right . |1988 App|
|00000170| 6c 65 20 43 6f 6d 70 75 | 74 65 72 2c 20 49 6e 63 |le Compu|ter, Inc|
|00000180| 2e 0d 23 09 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |..#.All |rights r|
|00000190| 65 73 65 72 76 65 64 2e | 0d 23 0d 23 09 56 65 72 |eserved.|.#.#.Ver|
|000001a0| 73 69 6f 6e 73 3a 09 31 | 2e 30 09 09 09 09 09 30 |sions:.1|.0.....0|
|000001b0| 38 2f 38 38 0d 23 09 09 | 09 09 31 2e 30 31 09 09 |8/88.#..|..1.01..|
|000001c0| 09 09 31 31 2f 38 38 0d | 23 0d 23 09 43 6f 6d 70 |..11/88.|#.#.Comp|
|000001d0| 6f 6e 65 6e 74 73 3a 09 | 53 61 6d 70 6c 65 2e 70 |onents:.|Sample.p|
|000001e0| 09 09 09 4e 6f 76 65 6d | 62 65 72 20 31 2c 20 31 |...Novem|ber 1, 1|
|000001f0| 39 38 38 0d 23 09 09 09 | 09 53 61 6d 70 6c 65 2e |988.#...|.Sample.|
|00000200| 63 09 09 09 4e 6f 76 65 | 6d 62 65 72 20 31 2c 20 |c...Nove|mber 1, |
|00000210| 31 39 38 38 0d 23 09 09 | 09 09 53 61 6d 70 6c 65 |1988.#..|..Sample|
|00000220| 2e 61 09 09 09 4e 6f 76 | 65 6d 62 65 72 20 31 2c |.a...Nov|ember 1,|
|00000230| 20 31 39 38 38 0d 23 09 | 09 09 09 53 61 6d 70 6c | 1988.#.|...Sampl|
|00000240| 65 2e 69 6e 63 31 2e 61 | 09 09 4e 6f 76 65 6d 62 |e.inc1.a|..Novemb|
|00000250| 65 72 20 31 2c 20 31 39 | 38 38 0d 23 09 09 09 09 |er 1, 19|88.#....|
|00000260| 53 61 6d 70 6c 65 4d 69 | 73 63 2e 61 09 09 4e 6f |SampleMi|sc.a..No|
|00000270| 76 65 6d 62 65 72 20 31 | 2c 20 31 39 38 38 0d 23 |vember 1|, 1988.#|
|00000280| 09 09 09 09 53 61 6d 70 | 6c 65 2e 72 09 09 09 4e |....Samp|le.r...N|
|00000290| 6f 76 65 6d 62 65 72 20 | 31 2c 20 31 39 38 38 0d |ovember |1, 1988.|
|000002a0| 23 09 09 09 09 53 61 6d | 70 6c 65 2e 68 09 09 09 |#....Sam|ple.h...|
|000002b0| 4e 6f 76 65 6d 62 65 72 | 20 31 2c 20 31 39 38 38 |November| 1, 1988|
|000002c0| 0d 23 09 09 09 09 50 53 | 61 6d 70 6c 65 2e 6d 61 |.#....PS|ample.ma|
|000002d0| 6b 65 09 09 4e 6f 76 65 | 6d 62 65 72 20 31 2c 20 |ke..Nove|mber 1, |
|000002e0| 31 39 38 38 0d 23 09 09 | 09 09 43 53 61 6d 70 6c |1988.#..|..CSampl|
|000002f0| 65 2e 6d 61 6b 65 09 09 | 4e 6f 76 65 6d 62 65 72 |e.make..|November|
|00000300| 20 31 2c 20 31 39 38 38 | 0d 23 09 09 09 09 41 53 | 1, 1988|.#....AS|
|00000310| 61 6d 70 6c 65 2e 6d 61 | 6b 65 09 09 4e 6f 76 65 |ample.ma|ke..Nove|
|00000320| 6d 62 65 72 20 31 2c 20 | 31 39 38 38 0d 23 0d 23 |mber 1, |1988.#.#|
|00000330| 09 53 61 6d 70 6c 65 20 | 69 73 20 61 6e 20 65 78 |.Sample |is an ex|
|00000340| 61 6d 70 6c 65 20 61 70 | 70 6c 69 63 61 74 69 6f |ample ap|plicatio|
|00000350| 6e 20 74 68 61 74 20 64 | 65 6d 6f 6e 73 74 72 61 |n that d|emonstra|
|00000360| 74 65 73 20 68 6f 77 20 | 74 6f 0d 23 09 69 6e 69 |tes how |to.#.ini|
|00000370| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 63 6f 6d 6d |tialize |the comm|
|00000380| 6f 6e 6c 79 20 75 73 65 | 64 20 74 6f 6f 6c 62 6f |only use|d toolbo|
|00000390| 78 20 6d 61 6e 61 67 65 | 72 73 2c 20 6f 70 65 72 |x manage|rs, oper|
|000003a0| 61 74 65 20 0d 23 09 73 | 75 63 63 65 73 73 66 75 |ate .#.s|uccessfu|
|000003b0| 6c 6c 79 20 75 6e 64 65 | 72 20 4d 75 6c 74 69 46 |lly unde|r MultiF|
|000003c0| 69 6e 64 65 72 2c 20 68 | 61 6e 64 6c 65 20 64 65 |inder, h|andle de|
|000003d0| 73 6b 20 61 63 63 65 73 | 73 6f 72 69 65 73 2c 20 |sk acces|sories, |
|000003e0| 0d 23 09 61 6e 64 20 63 | 72 65 61 74 65 2c 20 67 |.#.and c|reate, g|
|000003f0| 72 6f 77 2c 20 61 6e 64 | 20 7a 6f 6f 6d 20 77 69 |row, and| zoom wi|
|00000400| 6e 64 6f 77 73 2e 0d 23 | 0d 23 09 49 74 20 64 6f |ndows..#|.#.It do|
|00000410| 65 73 20 6e 6f 74 20 62 | 79 20 61 6e 79 20 6d 65 |es not b|y any me|
|00000420| 61 6e 73 20 64 65 6d 6f | 6e 73 74 72 61 74 65 20 |ans demo|nstrate |
|00000430| 61 6c 6c 20 74 68 65 20 | 74 65 63 68 6e 69 71 75 |all the |techniqu|
|00000440| 65 73 20 0d 23 09 79 6f | 75 20 6e 65 65 64 20 66 |es .#.yo|u need f|
|00000450| 6f 72 20 61 20 6c 61 72 | 67 65 20 61 70 70 6c 69 |or a lar|ge appli|
|00000460| 63 61 74 69 6f 6e 2e 20 | 49 6e 20 70 61 72 74 69 |cation. |In parti|
|00000470| 63 75 6c 61 72 2c 20 53 | 61 6d 70 6c 65 20 0d 23 |cular, S|ample .#|
|00000480| 09 64 6f 65 73 20 6e 6f | 74 20 63 6f 76 65 72 20 |.does no|t cover |
|00000490| 65 78 63 65 70 74 69 6f | 6e 20 68 61 6e 64 6c 69 |exceptio|n handli|
|000004a0| 6e 67 2c 20 6d 75 6c 74 | 69 70 6c 65 20 77 69 6e |ng, mult|iple win|
|000004b0| 64 6f 77 73 2f 64 6f 63 | 75 6d 65 6e 74 73 2c 20 |dows/doc|uments, |
|000004c0| 0d 23 09 73 6f 70 68 69 | 73 74 69 63 61 74 65 64 |.#.sophi|sticated|
|000004d0| 20 6d 65 6d 6f 72 79 20 | 6d 61 6e 61 67 65 6d 65 | memory |manageme|
|000004e0| 6e 74 2c 20 70 72 69 6e | 74 69 6e 67 2c 20 6f 72 |nt, prin|ting, or|
|000004f0| 20 75 6e 64 6f 2e 20 41 | 6c 6c 20 6f 66 20 0d 23 | undo. A|ll of .#|
|00000500| 09 74 68 65 73 65 20 61 | 72 65 20 76 69 74 61 6c |.these a|re vital|
|00000510| 20 70 61 72 74 73 20 6f | 66 20 61 20 6e 6f 72 6d | parts o|f a norm|
|00000520| 61 6c 20 66 75 6c 6c 2d | 73 69 7a 65 64 20 61 70 |al full-|sized ap|
|00000530| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 23 0d 23 09 54 |plicatio|n..#.#.T|
|00000540| 68 69 73 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |his appl|ication |
|00000550| 69 73 20 61 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |is an ex|ample of|
|00000560| 20 74 68 65 20 66 6f 72 | 6d 20 6f 66 20 61 20 4d | the for|m of a M|
|00000570| 61 63 69 6e 74 6f 73 68 | 20 0d 23 09 61 70 70 6c |acintosh| .#.appl|
|00000580| 69 63 61 74 69 6f 6e 3b | 20 69 74 20 69 73 20 4e |ication;| it is N|
|00000590| 4f 54 20 61 20 74 65 6d | 70 6c 61 74 65 2e 20 49 |OT a tem|plate. I|
|000005a0| 74 20 69 73 20 4e 4f 54 | 20 69 6e 74 65 6e 64 65 |t is NOT| intende|
|000005b0| 64 20 74 6f 20 62 65 20 | 0d 23 09 75 73 65 64 20 |d to be |.#.used |
|000005c0| 61 73 20 61 20 66 6f 75 | 6e 64 61 74 69 6f 6e 20 |as a fou|ndation |
|000005d0| 66 6f 72 20 74 68 65 20 | 6e 65 78 74 20 77 6f 72 |for the |next wor|
|000005e0| 6c 64 2d 63 6c 61 73 73 | 2c 20 62 65 73 74 2d 73 |ld-class|, best-s|
|000005f0| 65 6c 6c 69 6e 67 2c 20 | 0d 23 09 36 30 30 4b 20 |elling, |.#.600K |
|00000600| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 20 41 20 73 |applicat|ion. A s|
|00000610| 74 69 63 6b 20 66 69 67 | 75 72 65 20 64 72 61 77 |tick fig|ure draw|
|00000620| 69 6e 67 20 6f 66 20 74 | 68 65 20 68 75 6d 61 6e |ing of t|he human|
|00000630| 20 62 6f 64 79 20 6d 61 | 79 20 0d 23 09 62 65 20 | body ma|y .#.be |
|00000640| 61 20 67 6f 6f 64 20 65 | 78 61 6d 70 6c 65 20 6f |a good e|xample o|
|00000650| 66 20 74 68 65 20 66 6f | 72 6d 20 66 6f 72 20 61 |f the fo|rm for a|
|00000660| 20 70 61 69 6e 74 69 6e | 67 2c 20 62 75 74 20 74 | paintin|g, but t|
|00000670| 68 61 74 20 64 6f 65 73 | 20 6e 6f 74 20 0d 23 09 |hat does| not .#.|
|00000680| 6d 65 61 6e 20 69 74 20 | 73 68 6f 75 6c 64 20 62 |mean it |should b|
|00000690| 65 20 75 73 65 64 20 61 | 73 20 74 68 65 20 62 61 |e used a|s the ba|
|000006a0| 73 69 73 20 66 6f 72 20 | 74 68 65 20 6e 65 78 74 |sis for |the next|
|000006b0| 20 4d 6f 6e 61 20 4c 69 | 73 61 2e 0d 23 0d 23 09 | Mona Li|sa..#.#.|
|000006c0| 57 65 20 72 65 63 6f 6d | 6d 65 6e 64 20 74 68 61 |We recom|mend tha|
|000006d0| 74 20 79 6f 75 20 72 65 | 76 69 65 77 20 74 68 69 |t you re|view thi|
|000006e0| 73 20 70 72 6f 67 72 61 | 6d 20 6f 72 20 54 45 53 |s progra|m or TES|
|000006f0| 61 6d 70 6c 65 20 62 65 | 66 6f 72 65 20 0d 23 09 |ample be|fore .#.|
|00000700| 62 65 67 69 6e 6e 69 6e | 67 20 61 20 6e 65 77 20 |beginnin|g a new |
|00000710| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 0d 23 0d 2d |applicat|ion..#.-|
|00000720| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 7d 0d 0d |--------|-----}..|
|00000770| 0d 50 52 4f 47 52 41 4d | 20 53 61 6d 70 6c 65 3b |.PROGRAM| Sample;|
|00000780| 0d 0d 0d 7b 53 65 67 6d | 65 6e 74 61 74 69 6f 6e |...{Segm|entation|
|00000790| 20 73 74 72 61 74 65 67 | 79 3a 0d 0d 20 54 68 69 | strateg|y:.. Thi|
|000007a0| 73 20 70 72 6f 67 72 61 | 6d 20 63 6f 6e 73 69 73 |s progra|m consis|
|000007b0| 74 73 20 6f 66 20 74 68 | 72 65 65 20 73 65 67 6d |ts of th|ree segm|
|000007c0| 65 6e 74 73 2e 20 4d 61 | 69 6e 20 63 6f 6e 74 61 |ents. Ma|in conta|
|000007d0| 69 6e 73 20 6d 6f 73 74 | 20 6f 66 20 74 68 65 20 |ins most| of the |
|000007e0| 63 6f 64 65 2c 0d 20 69 | 6e 63 6c 75 64 69 6e 67 |code,. i|ncluding|
|000007f0| 20 74 68 65 20 4d 50 57 | 20 6c 69 62 72 61 72 69 | the MPW| librari|
|00000800| 65 73 2c 20 61 6e 64 20 | 74 68 65 20 6d 61 69 6e |es, and |the main|
|00000810| 20 70 72 6f 67 72 61 6d | 2e 20 49 6e 69 74 69 61 | program|. Initia|
|00000820| 6c 69 7a 65 20 63 6f 6e | 74 61 69 6e 73 0d 20 63 |lize con|tains. c|
|00000830| 6f 64 65 20 74 68 61 74 | 20 69 73 20 6f 6e 6c 79 |ode that| is only|
|00000840| 20 75 73 65 64 20 6f 6e | 63 65 2c 20 64 75 72 69 | used on|ce, duri|
|00000850| 6e 67 20 73 74 61 72 74 | 75 70 2c 20 61 6e 64 20 |ng start|up, and |
|00000860| 63 61 6e 20 62 65 20 75 | 6e 6c 6f 61 64 65 64 20 |can be u|nloaded |
|00000870| 61 66 74 65 72 20 74 68 | 65 0d 20 70 72 6f 67 72 |after th|e. progr|
|00000880| 61 6d 20 73 74 61 72 74 | 73 2e 20 25 41 35 49 6e |am start|s. %A5In|
|00000890| 69 74 20 69 73 20 61 75 | 74 6f 6d 61 74 69 63 61 |it is au|tomatica|
|000008a0| 6c 6c 79 20 63 72 65 61 | 74 65 64 20 62 79 20 74 |lly crea|ted by t|
|000008b0| 68 65 20 4c 69 6e 6b 65 | 72 20 74 6f 20 69 6e 69 |he Linke|r to ini|
|000008c0| 74 69 61 6c 69 7a 65 0d | 20 67 6c 6f 62 61 6c 73 |tialize.| globals|
|000008d0| 20 66 6f 72 20 74 68 65 | 20 4d 50 57 20 6c 69 62 | for the| MPW lib|
|000008e0| 72 61 72 69 65 73 20 61 | 6e 64 20 69 73 20 75 6e |raries a|nd is un|
|000008f0| 6c 6f 61 64 65 64 20 72 | 69 67 68 74 20 61 77 61 |loaded r|ight awa|
|00000900| 79 2e 7d 0d 0d 0d 7b 53 | 65 74 50 6f 72 74 20 73 |y.}...{S|etPort s|
|00000910| 74 72 61 74 65 67 79 3a | 0d 0d 20 54 6f 6f 6c 62 |trategy:|.. Toolb|
|00000920| 6f 78 20 72 6f 75 74 69 | 6e 65 73 20 64 6f 20 6e |ox routi|nes do n|
|00000930| 6f 74 20 63 68 61 6e 67 | 65 20 74 68 65 20 63 75 |ot chang|e the cu|
|00000940| 72 72 65 6e 74 20 70 6f | 72 74 2e 20 49 6e 20 73 |rrent po|rt. In s|
|00000950| 70 69 74 65 20 6f 66 20 | 74 68 69 73 2c 20 69 6e |pite of |this, in|
|00000960| 20 74 68 69 73 0d 20 70 | 72 6f 67 72 61 6d 20 77 | this. p|rogram w|
|00000970| 65 20 75 73 65 20 61 20 | 73 74 72 61 74 65 67 79 |e use a |strategy|
|00000980| 20 6f 66 20 63 61 6c 6c | 69 6e 67 20 53 65 74 50 | of call|ing SetP|
|00000990| 6f 72 74 20 77 68 65 6e | 65 76 65 72 20 77 65 20 |ort when|ever we |
|000009a0| 77 61 6e 74 20 74 6f 20 | 64 72 61 77 20 6f 72 0d |want to |draw or.|
|000009b0| 20 6d 61 6b 65 20 63 61 | 6c 6c 73 20 77 68 69 63 | make ca|lls whic|
|000009c0| 68 20 64 65 70 65 6e 64 | 20 6f 6e 20 74 68 65 20 |h depend| on the |
|000009d0| 63 75 72 72 65 6e 74 20 | 70 6f 72 74 2e 20 54 68 |current |port. Th|
|000009e0| 69 73 20 6d 61 6b 65 73 | 20 75 73 20 6c 65 73 73 |is makes| us less|
|000009f0| 20 76 75 6c 6e 65 72 61 | 62 6c 65 0d 20 74 6f 20 | vulnera|ble. to |
|00000a00| 62 75 67 73 20 69 6e 20 | 6f 74 68 65 72 20 73 6f |bugs in |other so|
|00000a10| 66 74 77 61 72 65 20 77 | 68 69 63 68 20 6d 69 67 |ftware w|hich mig|
|00000a20| 68 74 20 61 6c 74 65 72 | 20 74 68 65 20 63 75 72 |ht alter| the cur|
|00000a30| 72 65 6e 74 20 70 6f 72 | 74 20 28 73 75 63 68 20 |rent por|t (such |
|00000a40| 61 73 20 74 68 65 0d 20 | 62 75 67 20 28 66 65 61 |as the. |bug (fea|
|00000a50| 74 75 72 65 3f 29 20 69 | 6e 20 6d 61 6e 79 20 64 |ture?) i|n many d|
|00000a60| 65 73 6b 20 61 63 63 65 | 73 73 6f 72 69 65 73 20 |esk acce|ssories |
|00000a70| 77 68 69 63 68 20 63 68 | 61 6e 67 65 20 74 68 65 |which ch|ange the|
|00000a80| 20 70 6f 72 74 20 6f 6e | 20 4f 70 65 6e 44 65 73 | port on| OpenDes|
|00000a90| 6b 41 63 63 29 2e 0d 20 | 48 6f 70 65 66 75 6c 6c |kAcc).. |Hopefull|
|00000aa0| 79 2c 20 74 68 69 73 20 | 61 6c 73 6f 20 6d 61 6b |y, this |also mak|
|00000ab0| 65 73 20 74 68 65 20 72 | 6f 75 74 69 6e 65 73 20 |es the r|outines |
|00000ac0| 66 72 6f 6d 20 74 68 69 | 73 20 70 72 6f 67 72 61 |from thi|s progra|
|00000ad0| 6d 20 6d 6f 72 65 20 73 | 65 6c 66 2d 63 6f 6e 74 |m more s|elf-cont|
|00000ae0| 61 69 6e 65 64 2c 0d 20 | 73 69 6e 63 65 20 74 68 |ained,. |since th|
|00000af0| 65 79 20 64 6f 6e 27 74 | 20 64 65 70 65 6e 64 20 |ey don't| depend |
|00000b00| 6f 6e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |on the c|urrent p|
|00000b10| 6f 72 74 20 73 65 74 74 | 69 6e 67 2e 7d 0d 0d 0d |ort sett|ing.}...|
|00000b20| 55 53 45 53 0d 09 4d 65 | 6d 54 79 70 65 73 2c 20 |USES..Me|mTypes, |
|00000b30| 51 75 69 63 6b 44 72 61 | 77 2c 20 4f 53 49 6e 74 |QuickDra|w, OSInt|
|00000b40| 66 2c 20 54 6f 6f 6c 49 | 6e 74 66 2c 20 50 61 63 |f, ToolI|ntf, Pac|
|00000b50| 6b 49 6e 74 66 3b 0d 0d | 43 4f 4e 53 54 0d 09 7b |kIntf;..|CONST..{|
|00000b60| 4d 50 57 20 33 2e 30 20 | 77 69 6c 6c 20 69 6e 63 |MPW 3.0 |will inc|
|00000b70| 6c 75 64 65 20 61 20 54 | 72 61 70 73 2e 70 20 69 |lude a T|raps.p i|
|00000b80| 6e 74 65 72 66 61 63 65 | 20 66 69 6c 65 20 74 68 |nterface| file th|
|00000b90| 61 74 20 69 6e 63 6c 75 | 64 65 73 20 63 6f 6e 73 |at inclu|des cons|
|00000ba0| 74 61 6e 74 73 20 66 6f | 72 20 74 72 61 70 20 6e |tants fo|r trap n|
|00000bb0| 75 6d 62 65 72 73 2e 0d | 09 20 54 68 65 73 65 20 |umbers..|. These |
|00000bc0| 63 6f 6e 73 74 61 6e 74 | 73 20 61 72 65 20 66 72 |constant|s are fr|
|00000bd0| 6f 6d 20 74 68 61 74 20 | 66 69 6c 65 2e 7d 0d 09 |om that |file.}..|
|00000be0| 5f 57 61 69 74 4e 65 78 | 74 45 76 65 6e 74 09 09 |_WaitNex|tEvent..|
|00000bf0| 09 3d 20 24 41 38 36 30 | 3b 0d 09 5f 55 6e 69 6d |.= $A860|;.._Unim|
|00000c00| 70 6c 65 6d 65 6e 74 65 | 64 09 09 09 3d 20 24 41 |plemente|d...= $A|
|00000c10| 38 39 46 3b 0d 0d 09 7b | 31 2e 30 31 20 2d 20 63 |89F;...{|1.01 - c|
|00000c20| 68 61 6e 67 65 64 20 63 | 6f 6e 73 74 61 6e 74 73 |hanged c|onstants|
|00000c30| 20 74 6f 20 62 65 67 69 | 6e 20 77 69 74 68 20 27 | to begi|n with '|
|00000c40| 6b 27 20 66 6f 72 20 63 | 6f 6e 73 69 73 74 65 6e |k' for c|onsisten|
|00000c50| 63 79 2c 20 65 78 63 65 | 70 74 20 66 6f 72 20 72 |cy, exce|pt for r|
|00000c60| 65 73 6f 75 72 63 65 20 | 49 44 73 7d 0d 09 7b 53 |esource |IDs}..{S|
|00000c70| 79 73 45 6e 76 69 72 6f | 6e 73 56 65 72 73 69 6f |ysEnviro|nsVersio|
|00000c80| 6e 20 69 73 20 70 61 73 | 73 65 64 20 74 6f 20 53 |n is pas|sed to S|
|00000c90| 79 73 45 6e 76 69 72 6f | 6e 73 20 74 6f 20 74 65 |ysEnviro|ns to te|
|00000ca0| 6c 6c 20 69 74 20 77 68 | 69 63 68 20 76 65 72 73 |ll it wh|ich vers|
|00000cb0| 69 6f 6e 20 6f 66 20 74 | 68 65 0d 09 20 53 79 73 |ion of t|he.. Sys|
|00000cc0| 45 6e 76 52 65 63 20 77 | 65 20 75 6e 64 65 72 73 |EnvRec w|e unders|
|00000cd0| 74 61 6e 64 2e 7d 0d 09 | 6b 53 79 73 45 6e 76 69 |tand.}..|kSysEnvi|
|00000ce0| 72 6f 6e 73 56 65 72 73 | 69 6f 6e 09 09 3d 20 31 |ronsVers|ion..= 1|
|00000cf0| 3b 0d 0d 09 7b 4f 53 45 | 76 65 6e 74 20 69 73 20 |;...{OSE|vent is |
|00000d00| 74 68 65 20 65 76 65 6e | 74 20 6e 75 6d 62 65 72 |the even|t number|
|00000d10| 20 6f 66 20 74 68 65 20 | 73 75 73 70 65 6e 64 2f | of the |suspend/|
|00000d20| 72 65 73 75 6d 65 20 61 | 6e 64 20 6d 6f 75 73 65 |resume a|nd mouse|
|00000d30| 2d 6d 6f 76 65 64 20 65 | 76 65 6e 74 73 20 73 65 |-moved e|vents se|
|00000d40| 6e 74 0d 09 20 62 79 20 | 4d 75 6c 74 69 46 69 6e |nt.. by |MultiFin|
|00000d50| 64 65 72 2e 20 4f 6e 63 | 65 20 77 65 20 64 65 74 |der. Onc|e we det|
|00000d60| 65 72 6d 69 6e 65 20 74 | 68 61 74 20 61 6e 20 65 |ermine t|hat an e|
|00000d70| 76 65 6e 74 20 69 73 20 | 61 6e 20 6f 73 45 76 65 |vent is |an osEve|
|00000d80| 6e 74 2c 20 77 65 20 6c | 6f 6f 6b 20 61 74 20 74 |nt, we l|ook at t|
|00000d90| 68 65 0d 09 20 68 69 67 | 68 20 62 79 74 65 20 6f |he.. hig|h byte o|
|00000da0| 66 20 74 68 65 20 6d 65 | 73 73 61 67 65 20 73 65 |f the me|ssage se|
|00000db0| 6e 74 20 74 6f 20 64 65 | 74 65 72 6d 69 6e 65 20 |nt to de|termine |
|00000dc0| 77 68 69 63 68 20 6b 69 | 6e 64 20 69 74 20 69 73 |which ki|nd it is|
|00000dd0| 2e 20 54 6f 20 64 69 66 | 66 65 72 65 6e 74 69 61 |. To dif|ferentia|
|00000de0| 74 65 0d 09 20 73 75 73 | 70 65 6e 64 20 61 6e 64 |te.. sus|pend and|
|00000df0| 20 72 65 73 75 6d 65 20 | 65 76 65 6e 74 73 20 77 | resume |events w|
|00000e00| 65 20 63 68 65 63 6b 20 | 74 68 65 20 72 65 73 75 |e check |the resu|
|00000e10| 6d 65 4d 61 73 6b 20 62 | 69 74 2e 7d 0d 09 6b 4f |meMask b|it.}..kO|
|00000e20| 53 45 76 65 6e 74 09 09 | 09 09 3d 20 61 70 70 34 |SEvent..|..= app4|
|00000e30| 45 76 74 3b 09 7b 65 76 | 65 6e 74 20 75 73 65 64 |Evt;.{ev|ent used|
|00000e40| 20 62 79 20 4d 75 6c 74 | 69 46 69 6e 64 65 72 7d | by Mult|iFinder}|
|00000e50| 0d 09 6b 53 75 73 70 65 | 6e 64 52 65 73 75 6d 65 |..kSuspe|ndResume|
|00000e60| 4d 65 73 73 61 67 65 09 | 3d 20 31 3b 09 09 7b 68 |Message.|= 1;..{h|
|00000e70| 69 67 68 20 62 79 74 65 | 20 6f 66 20 73 75 73 70 |igh byte| of susp|
|00000e80| 65 6e 64 2f 72 65 73 75 | 6d 65 20 65 76 65 6e 74 |end/resu|me event|
|00000e90| 20 6d 65 73 73 61 67 65 | 7d 0d 09 6b 52 65 73 75 | message|}..kResu|
|00000ea0| 6d 65 4d 61 73 6b 09 09 | 09 09 3d 20 31 3b 09 09 |meMask..|..= 1;..|
|00000eb0| 7b 62 69 74 20 6f 66 20 | 6d 65 73 73 61 67 65 20 |{bit of |message |
|00000ec0| 66 69 65 6c 64 20 66 6f | 72 20 72 65 73 75 6d 65 |field fo|r resume|
|00000ed0| 20 76 73 2e 20 73 75 73 | 70 65 6e 64 7d 0d 0d 09 | vs. sus|pend}...|
|00000ee0| 7b 31 2e 30 31 20 2d 20 | 6b 4d 69 6e 48 65 61 70 |{1.01 - |kMinHeap|
|00000ef0| 20 2d 20 54 68 69 73 20 | 69 73 20 74 68 65 20 6d | - This |is the m|
|00000f00| 69 6e 69 6d 75 6d 20 72 | 65 73 75 6c 74 20 66 72 |inimum r|esult fr|
|00000f10| 6f 6d 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |om the f|ollowing|
|00000f20| 0d 09 20 65 71 75 61 74 | 69 6f 6e 3a 0d 09 09 09 |.. equat|ion:....|
|00000f30| 0d 09 09 09 4f 52 44 28 | 47 65 74 41 70 70 6c 4c |....ORD(|GetApplL|
|00000f40| 69 6d 69 74 29 20 2d 20 | 4f 52 44 28 41 70 70 6c |imit) - |ORD(Appl|
|00000f50| 69 63 5a 6f 6e 65 29 0d | 09 09 09 0d 09 20 66 6f |icZone).|..... fo|
|00000f60| 72 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |r the ap|plicatio|
|00000f70| 6e 20 74 6f 20 72 75 6e | 2e 20 49 74 20 77 69 6c |n to run|. It wil|
|00000f80| 6c 20 69 6e 73 75 72 65 | 20 74 68 61 74 20 65 6e |l insure| that en|
|00000f90| 6f 75 67 68 20 6d 65 6d | 6f 72 79 20 77 69 6c 6c |ough mem|ory will|
|00000fa0| 0d 09 20 62 65 20 61 72 | 6f 75 6e 64 20 66 6f 72 |.. be ar|ound for|
|00000fb0| 20 72 65 61 73 6f 6e 61 | 62 6c 65 2d 73 69 7a 65 | reasona|ble-size|
|00000fc0| 64 20 73 63 72 61 70 73 | 2c 20 46 4b 45 59 73 2c |d scraps|, FKEYs,|
|00000fd0| 20 65 74 63 2e 20 74 6f | 20 65 78 69 73 74 20 77 | etc. to| exist w|
|00000fe0| 69 74 68 20 74 68 65 0d | 09 20 61 70 70 6c 69 63 |ith the.|. applic|
|00000ff0| 61 74 69 6f 6e 2c 20 61 | 6e 64 20 73 74 69 6c 6c |ation, a|nd still|
|00001000| 20 67 69 76 65 20 74 68 | 65 20 61 70 70 6c 69 63 | give th|e applic|
|00001010| 61 74 69 6f 6e 20 73 6f | 6d 65 20 27 62 72 65 61 |ation so|me 'brea|
|00001020| 74 68 69 6e 67 20 72 6f | 6f 6d 27 2e 0d 09 20 54 |thing ro|om'... T|
|00001030| 6f 20 64 65 72 69 76 65 | 20 74 68 69 73 20 6e 75 |o derive| this nu|
|00001040| 6d 62 65 72 2c 20 77 65 | 20 72 61 6e 20 75 6e 64 |mber, we| ran und|
|00001050| 65 72 20 61 20 4d 75 6c | 74 69 46 69 6e 64 65 72 |er a Mul|tiFinder|
|00001060| 20 70 61 72 74 69 74 69 | 6f 6e 20 74 68 61 74 20 | partiti|on that |
|00001070| 77 61 73 0d 09 20 6f 75 | 72 20 72 65 71 75 65 73 |was.. ou|r reques|
|00001080| 74 65 64 20 6d 69 6e 69 | 6d 75 6d 20 73 69 7a 65 |ted mini|mum size|
|00001090| 2c 20 61 73 20 67 69 76 | 65 6e 20 69 6e 20 74 68 |, as giv|en in th|
|000010a0| 65 20 27 53 49 5a 45 27 | 20 72 65 73 6f 75 72 63 |e 'SIZE'| resourc|
|000010b0| 65 2e 7d 0d 09 20 0d 09 | 6b 4d 69 6e 48 65 61 70 |e.}.. ..|kMinHeap|
|000010c0| 09 3d 20 32 31 20 2a 20 | 31 30 32 34 3b 0d 09 0d |.= 21 * |1024;...|
|000010d0| 09 7b 31 2e 30 31 20 2d | 20 6b 4d 69 6e 53 70 61 |.{1.01 -| kMinSpa|
|000010e0| 63 65 20 2d 20 54 68 69 | 73 20 69 73 20 74 68 65 |ce - Thi|s is the|
|000010f0| 20 6d 69 6e 69 6d 75 6d | 20 72 65 73 75 6c 74 20 | minimum| result |
|00001100| 66 72 6f 6d 20 50 75 72 | 67 65 53 70 61 63 65 2c |from Pur|geSpace,|
|00001110| 20 77 68 65 6e 20 63 61 | 6c 6c 65 64 0d 09 20 61 | when ca|lled.. a|
|00001120| 74 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e |t initia|lization|
|00001130| 20 74 69 6d 65 2c 20 66 | 6f 72 20 74 68 65 20 61 | time, f|or the a|
|00001140| 70 70 6c 69 63 61 74 69 | 6f 6e 20 74 6f 20 72 75 |pplicati|on to ru|
|00001150| 6e 2e 20 54 68 69 73 20 | 6e 75 6d 62 65 72 20 61 |n. This |number a|
|00001160| 63 74 73 0d 09 20 61 73 | 20 61 20 64 6f 75 62 6c |cts.. as| a doubl|
|00001170| 65 2d 63 68 65 63 6b 20 | 74 6f 20 69 6e 73 75 72 |e-check |to insur|
|00001180| 65 20 74 68 61 74 20 74 | 68 65 72 65 20 72 65 61 |e that t|here rea|
|00001190| 6c 6c 79 20 69 73 20 65 | 6e 6f 75 67 68 20 6d 65 |lly is e|nough me|
|000011a0| 6d 6f 72 79 20 66 6f 72 | 20 74 68 65 0d 09 20 61 |mory for| the.. a|
|000011b0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 74 6f 20 72 75 |pplicati|on to ru|
|000011c0| 6e 2c 20 69 6e 63 6c 75 | 64 69 6e 67 20 77 68 61 |n, inclu|ding wha|
|000011d0| 74 20 68 61 73 20 62 65 | 65 6e 20 74 61 6b 65 6e |t has be|en taken|
|000011e0| 20 75 70 20 61 6c 72 65 | 61 64 79 20 62 79 0d 09 | up alre|ady by..|
|000011f0| 20 70 72 65 2d 6c 6f 61 | 64 65 64 20 72 65 73 6f | pre-loa|ded reso|
|00001200| 75 72 63 65 73 2c 20 74 | 68 65 20 73 63 72 61 70 |urces, t|he scrap|
|00001210| 2c 20 63 6f 64 65 2c 20 | 61 6e 64 20 6f 74 68 65 |, code, |and othe|
|00001220| 72 20 73 75 6e 64 72 79 | 20 6d 65 6d 6f 72 79 20 |r sundry| memory |
|00001230| 62 6c 6f 63 6b 73 2e 7d | 0d 09 20 0d 09 6b 4d 69 |blocks.}|.. ..kMi|
|00001240| 6e 53 70 61 63 65 09 3d | 20 38 20 2a 20 31 30 32 |nSpace.=| 8 * 102|
|00001250| 34 3b 0d 09 0d 09 7b 6b | 45 78 74 72 65 6d 65 4e |4;....{k|ExtremeN|
|00001260| 65 67 20 61 6e 64 20 6b | 45 78 74 72 65 6d 65 50 |eg and k|ExtremeP|
|00001270| 6f 73 20 61 72 65 20 75 | 73 65 64 20 74 6f 20 73 |os are u|sed to s|
|00001280| 65 74 20 75 70 20 77 69 | 64 65 20 6f 70 65 6e 20 |et up wi|de open |
|00001290| 72 65 63 74 61 6e 67 6c | 65 73 20 61 6e 64 20 72 |rectangl|es and r|
|000012a0| 65 67 69 6f 6e 73 2e 7d | 0d 09 6b 45 78 74 72 65 |egions.}|..kExtre|
|000012b0| 6d 65 4e 65 67 09 3d 20 | 2d 33 32 37 36 38 3b 0d |meNeg.= |-32768;.|
|000012c0| 09 6b 45 78 74 72 65 6d | 65 50 6f 73 09 3d 20 33 |.kExtrem|ePos.= 3|
|000012d0| 32 37 36 37 20 2d 20 31 | 3b 09 09 09 7b 72 65 71 |2767 - 1|;...{req|
|000012e0| 75 69 72 65 64 20 66 6f | 72 20 6f 6c 64 20 72 65 |uired fo|r old re|
|000012f0| 67 69 6f 6e 20 62 75 67 | 7d 0d 09 0d 09 7b 54 68 |gion bug|}....{Th|
|00001300| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 63 6f 6e 73 |e follow|ing cons|
|00001310| 74 61 6e 74 73 20 61 72 | 65 20 61 6c 6c 20 72 65 |tants ar|e all re|
|00001320| 73 6f 75 72 63 65 20 49 | 44 73 2c 20 63 6f 72 72 |source I|Ds, corr|
|00001330| 65 73 70 6f 6e 64 69 6e | 67 20 74 6f 20 72 65 73 |espondin|g to res|
|00001340| 6f 75 72 63 65 73 20 69 | 6e 20 53 61 6d 70 6c 65 |ources i|n Sample|
|00001350| 2e 72 2e 7d 0d 09 72 4d | 65 6e 75 42 61 72 09 3d |.r.}..rM|enuBar.=|
|00001360| 20 31 32 38 3b 09 09 09 | 09 09 7b 61 70 70 6c 69 | 128;...|..{appli|
|00001370| 63 61 74 69 6f 6e 27 73 | 20 6d 65 6e 75 20 62 61 |cation's| menu ba|
|00001380| 72 7d 0d 09 72 41 62 6f | 75 74 41 6c 65 72 74 09 |r}..rAbo|utAlert.|
|00001390| 3d 20 31 32 38 3b 09 09 | 09 09 09 7b 61 62 6f 75 |= 128;..|...{abou|
|000013a0| 74 20 61 6c 65 72 74 7d | 0d 09 72 55 73 65 72 41 |t alert}|..rUserA|
|000013b0| 6c 65 72 74 09 3d 20 31 | 32 39 3b 09 09 09 09 09 |lert.= 1|29;.....|
|000013c0| 7b 65 72 72 6f 72 20 75 | 73 65 72 20 61 6c 65 72 |{error u|ser aler|
|000013d0| 74 7d 0d 09 72 57 69 6e | 64 6f 77 09 09 3d 20 31 |t}..rWin|dow..= 1|
|000013e0| 32 38 3b 09 09 09 09 09 | 7b 61 70 70 6c 69 63 61 |28;.....|{applica|
|000013f0| 74 69 6f 6e 27 73 20 77 | 69 6e 64 6f 77 7d 0d 09 |tion's w|indow}..|
|00001400| 72 53 74 6f 70 52 65 63 | 74 09 3d 20 31 32 38 3b |rStopRec|t.= 128;|
|00001410| 09 09 09 09 09 7b 72 65 | 63 74 61 6e 67 6c 65 20 |.....{re|ctangle |
|00001420| 66 6f 72 20 53 74 6f 70 | 20 6c 69 67 68 74 7d 0d |for Stop| light}.|
|00001430| 09 72 47 6f 52 65 63 74 | 09 09 3d 20 31 32 39 3b |.rGoRect|..= 129;|
|00001440| 09 09 09 09 09 7b 72 65 | 63 74 61 6e 67 6c 65 20 |.....{re|ctangle |
|00001450| 66 6f 72 20 47 6f 20 6c | 69 67 68 74 7d 0d 0d 09 |for Go l|ight}...|
|00001460| 7b 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 63 |{The fol|lowing c|
|00001470| 6f 6e 73 74 61 6e 74 73 | 20 61 72 65 20 75 73 65 |onstants| are use|
|00001480| 64 20 74 6f 20 69 64 65 | 6e 74 69 66 79 20 6d 65 |d to ide|ntify me|
|00001490| 6e 75 73 20 61 6e 64 20 | 74 68 65 69 72 20 69 74 |nus and |their it|
|000014a0| 65 6d 73 2e 20 54 68 65 | 20 6d 65 6e 75 20 49 44 |ems. The| menu ID|
|000014b0| 73 0d 09 20 68 61 76 65 | 20 61 6e 20 22 6d 22 20 |s.. have| an "m" |
|000014c0| 70 72 65 66 69 78 20 61 | 6e 64 20 74 68 65 20 69 |prefix a|nd the i|
|000014d0| 74 65 6d 20 6e 75 6d 62 | 65 72 73 20 77 69 74 68 |tem numb|ers with|
|000014e0| 69 6e 20 65 61 63 68 20 | 6d 65 6e 75 20 68 61 76 |in each |menu hav|
|000014f0| 65 20 61 6e 20 22 69 22 | 20 70 72 65 66 69 78 2e |e an "i"| prefix.|
|00001500| 7d 0d 09 6d 41 70 70 6c | 65 09 09 3d 20 31 32 38 |}..mAppl|e..= 128|
|00001510| 3b 09 09 09 09 09 7b 41 | 70 70 6c 65 20 6d 65 6e |;.....{A|pple men|
|00001520| 75 7d 0d 09 69 41 62 6f | 75 74 09 09 3d 20 31 3b |u}..iAbo|ut..= 1;|
|00001530| 0d 0d 09 6d 46 69 6c 65 | 09 09 3d 20 31 32 39 3b |...mFile|..= 129;|
|00001540| 09 09 09 09 09 7b 46 69 | 6c 65 20 6d 65 6e 75 7d |.....{Fi|le menu}|
|00001550| 0d 09 69 4e 65 77 09 09 | 3d 20 31 3b 0d 09 69 43 |..iNew..|= 1;..iC|
|00001560| 6c 6f 73 65 09 09 3d 20 | 34 3b 0d 09 69 51 75 69 |lose..= |4;..iQui|
|00001570| 74 09 09 3d 20 31 32 3b | 0d 0d 09 6d 45 64 69 74 |t..= 12;|...mEdit|
|00001580| 09 09 3d 20 31 33 30 3b | 09 09 09 09 09 7b 45 64 |..= 130;|.....{Ed|
|00001590| 69 74 20 6d 65 6e 75 7d | 0d 09 69 55 6e 64 6f 09 |it menu}|..iUndo.|
|000015a0| 09 3d 20 31 3b 0d 09 69 | 43 75 74 09 09 3d 20 33 |.= 1;..i|Cut..= 3|
|000015b0| 3b 0d 09 69 43 6f 70 79 | 09 09 3d 20 34 3b 0d 09 |;..iCopy|..= 4;..|
|000015c0| 69 50 61 73 74 65 09 09 | 3d 20 35 3b 0d 09 69 43 |iPaste..|= 5;..iC|
|000015d0| 6c 65 61 72 09 09 3d 20 | 36 3b 0d 0d 09 6d 4c 69 |lear..= |6;...mLi|
|000015e0| 67 68 74 09 09 3d 20 31 | 33 31 3b 09 09 09 09 09 |ght..= 1|31;.....|
|000015f0| 7b 4c 69 67 68 74 20 6d | 65 6e 75 7d 0d 09 69 53 |{Light m|enu}..iS|
|00001600| 74 6f 70 09 09 3d 20 31 | 3b 0d 09 69 47 6f 09 09 |top..= 1|;..iGo..|
|00001610| 09 3d 20 32 3b 0d 09 0d | 09 7b 31 2e 30 31 20 2d |.= 2;...|.{1.01 -|
|00001620| 20 6b 44 49 54 6f 70 20 | 61 6e 64 20 6b 44 49 4c | kDITop |and kDIL|
|00001630| 65 66 74 20 61 72 65 20 | 75 73 65 64 20 74 6f 20 |eft are |used to |
|00001640| 6c 6f 63 61 74 65 20 74 | 68 65 20 44 69 73 6b 20 |locate t|he Disk |
|00001650| 49 6e 69 74 69 61 6c 69 | 7a 61 74 69 6f 6e 20 64 |Initiali|zation d|
|00001660| 69 61 6c 6f 67 73 2e 7d | 0d 09 6b 44 49 54 6f 70 |ialogs.}|..kDITop|
|00001670| 09 09 3d 20 24 30 30 35 | 30 3b 0d 09 6b 44 49 4c |..= $005|0;..kDIL|
|00001680| 65 66 74 09 09 3d 20 24 | 30 30 37 30 3b 0d 0d 0d |eft..= $|0070;...|
|00001690| 56 41 52 0d 09 7b 54 68 | 65 20 22 67 22 20 70 72 |VAR..{Th|e "g" pr|
|000016a0| 65 66 69 78 20 69 73 20 | 75 73 65 64 20 74 6f 20 |efix is |used to |
|000016b0| 65 6d 70 68 61 73 69 7a | 65 20 74 68 61 74 20 61 |emphasiz|e that a|
|000016c0| 20 76 61 72 69 61 62 6c | 65 20 69 73 20 67 6c 6f | variabl|e is glo|
|000016d0| 62 61 6c 2e 7d 0d 0d 09 | 7b 47 4d 61 63 20 69 73 |bal.}...|{GMac is|
|000016e0| 20 75 73 65 64 20 74 6f | 20 68 6f 6c 64 20 74 68 | used to| hold th|
|000016f0| 65 20 72 65 73 75 6c 74 | 20 6f 66 20 61 20 53 79 |e result| of a Sy|
|00001700| 73 45 6e 76 69 72 6f 6e | 73 20 63 61 6c 6c 2e 20 |sEnviron|s call. |
|00001710| 54 68 69 73 20 6d 61 6b | 65 73 0d 09 20 69 74 20 |This mak|es.. it |
|00001720| 63 6f 6e 76 65 6e 69 65 | 6e 74 20 66 6f 72 20 61 |convenie|nt for a|
|00001730| 6e 79 20 72 6f 75 74 69 | 6e 65 20 74 6f 20 63 68 |ny routi|ne to ch|
|00001740| 65 63 6b 20 74 68 65 20 | 65 6e 76 69 72 6f 6e 6d |eck the |environm|
|00001750| 65 6e 74 2e 20 49 74 20 | 69 73 0d 09 20 67 6c 6f |ent. It |is.. glo|
|00001760| 62 61 6c 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 2c |bal info|rmation,|
|00001770| 20 61 6e 79 77 61 79 2e | 7d 0d 09 67 4d 61 63 09 | anyway.|}..gMac.|
|00001780| 09 09 09 3a 20 53 79 73 | 45 6e 76 52 65 63 3b 09 |...: Sys|EnvRec;.|
|00001790| 7b 73 65 74 20 75 70 20 | 62 79 20 49 6e 69 74 69 |{set up |by Initi|
|000017a0| 61 6c 69 7a 65 7d 0d 0d | 09 7b 47 48 61 73 57 61 |alize}..|.{GHasWa|
|000017b0| 69 74 4e 65 78 74 45 76 | 65 6e 74 20 69 73 20 73 |itNextEv|ent is s|
|000017c0| 65 74 20 61 74 20 73 74 | 61 72 74 75 70 2c 20 61 |et at st|artup, a|
|000017d0| 6e 64 20 74 65 6c 6c 73 | 20 77 68 65 74 68 65 72 |nd tells| whether|
|000017e0| 20 74 68 65 20 57 61 69 | 74 4e 65 78 74 45 76 65 | the Wai|tNextEve|
|000017f0| 6e 74 0d 09 20 74 72 61 | 70 20 69 73 20 61 76 61 |nt.. tra|p is ava|
|00001800| 69 6c 61 62 6c 65 2e 20 | 49 66 20 69 74 20 69 73 |ilable. |If it is|
|00001810| 20 66 61 6c 73 65 2c 20 | 77 65 20 6b 6e 6f 77 20 | false, |we know |
|00001820| 74 68 61 74 20 77 65 20 | 6d 75 73 74 20 63 61 6c |that we |must cal|
|00001830| 6c 20 47 65 74 4e 65 78 | 74 45 76 65 6e 74 2e 7d |l GetNex|tEvent.}|
|00001840| 0d 09 67 48 61 73 57 61 | 69 74 4e 65 78 74 45 76 |..gHasWa|itNextEv|
|00001850| 65 6e 74 09 3a 20 42 4f | 4f 4c 45 41 4e 3b 09 09 |ent.: BO|OLEAN;..|
|00001860| 7b 73 65 74 20 75 70 20 | 62 79 20 49 6e 69 74 69 |{set up |by Initi|
|00001870| 61 6c 69 7a 65 7d 0d 0d | 09 7b 47 49 6e 42 61 63 |alize}..|.{GInBac|
|00001880| 6b 67 72 6f 75 6e 64 20 | 69 73 20 6d 61 69 6e 74 |kground |is maint|
|00001890| 61 69 6e 65 64 20 62 79 | 20 6f 75 72 20 6f 73 45 |ained by| our osE|
|000018a0| 76 65 6e 74 20 68 61 6e | 64 6c 69 6e 67 20 72 6f |vent han|dling ro|
|000018b0| 75 74 69 6e 65 73 2e 20 | 41 6e 79 20 70 61 72 74 |utines. |Any part|
|000018c0| 20 6f 66 0d 09 20 74 68 | 65 20 70 72 6f 67 72 61 | of.. th|e progra|
|000018d0| 6d 20 63 61 6e 20 63 68 | 65 63 6b 20 69 74 20 74 |m can ch|eck it t|
|000018e0| 6f 20 66 69 6e 64 20 6f | 75 74 20 69 66 20 69 74 |o find o|ut if it|
|000018f0| 20 69 73 20 63 75 72 72 | 65 6e 74 6c 79 20 69 6e | is curr|ently in|
|00001900| 20 74 68 65 20 62 61 63 | 6b 67 72 6f 75 6e 64 2e | the bac|kground.|
|00001910| 7d 0d 09 67 49 6e 42 61 | 63 6b 67 72 6f 75 6e 64 |}..gInBa|ckground|
|00001920| 09 09 3a 20 42 4f 4f 4c | 45 41 4e 3b 09 09 7b 6d |..: BOOL|EAN;..{m|
|00001930| 61 69 6e 74 61 69 6e 65 | 64 20 62 79 20 49 6e 69 |aintaine|d by Ini|
|00001940| 74 69 61 6c 69 7a 65 20 | 61 6e 64 20 44 6f 45 76 |tialize |and DoEv|
|00001950| 65 6e 74 7d 0d 0d 0d 09 | 7b 54 68 65 20 66 6f 6c |ent}....|{The fol|
|00001960| 6c 6f 77 69 6e 67 20 67 | 6c 6f 62 61 6c 73 20 61 |lowing g|lobals a|
|00001970| 72 65 20 74 68 65 20 73 | 74 61 74 65 20 6f 66 20 |re the s|tate of |
|00001980| 74 68 65 20 77 69 6e 64 | 6f 77 2e 20 49 66 20 77 |the wind|ow. If w|
|00001990| 65 20 73 75 70 70 6f 72 | 74 65 64 20 6d 6f 72 65 |e suppor|ted more|
|000019a0| 20 74 68 61 6e 0d 09 20 | 6f 6e 65 20 77 69 6e 64 | than.. |one wind|
|000019b0| 6f 77 2c 20 74 68 65 79 | 20 77 6f 75 6c 64 20 62 |ow, they| would b|
|000019c0| 65 20 61 74 74 61 74 63 | 68 65 64 20 74 6f 20 65 |e attatc|hed to e|
|000019d0| 61 63 68 20 64 6f 63 75 | 6d 65 6e 74 2c 20 72 61 |ach docu|ment, ra|
|000019e0| 74 68 65 72 20 74 68 61 | 6e 20 67 6c 6f 62 61 6c |ther tha|n global|
|000019f0| 73 2e 7d 0d 0d 09 7b 47 | 53 74 6f 70 70 65 64 20 |s.}...{G|Stopped |
|00001a00| 74 65 6c 6c 73 20 77 68 | 65 74 68 65 72 20 74 68 |tells wh|ether th|
|00001a10| 65 20 73 74 6f 70 20 6c | 69 67 68 74 20 69 73 20 |e stop l|ight is |
|00001a20| 63 75 72 72 65 6e 74 6c | 79 20 6f 6e 20 73 74 6f |currentl|y on sto|
|00001a30| 70 20 6f 72 20 67 6f 2e | 7d 0d 09 67 53 74 6f 70 |p or go.|}..gStop|
|00001a40| 70 65 64 09 09 09 3a 20 | 42 4f 4f 4c 45 41 4e 3b |ped...: |BOOLEAN;|
|00001a50| 09 09 7b 6d 61 69 6e 74 | 61 69 6e 65 64 20 62 79 |..{maint|ained by|
|00001a60| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 61 6e 64 20 | Initial|ize and |
|00001a70| 53 65 74 4c 69 67 68 74 | 7d 0d 0d 09 7b 47 53 74 |SetLight|}...{GSt|
|00001a80| 6f 70 52 65 63 74 20 61 | 6e 64 20 67 47 6f 52 65 |opRect a|nd gGoRe|
|00001a90| 63 74 20 61 72 65 20 74 | 68 65 20 72 65 63 74 61 |ct are t|he recta|
|00001aa0| 6e 67 6c 65 73 20 6f 66 | 20 74 68 65 20 74 77 6f |ngles of| the two|
|00001ab0| 20 73 74 6f 70 20 6c 69 | 67 68 74 73 20 69 6e 20 | stop li|ghts in |
|00001ac0| 74 68 65 20 77 69 6e 64 | 6f 77 2e 7d 0d 09 67 53 |the wind|ow.}..gS|
|00001ad0| 74 6f 70 52 65 63 74 09 | 09 09 3a 20 52 65 63 74 |topRect.|..: Rect|
|00001ae0| 3b 09 09 09 7b 73 65 74 | 20 75 70 20 62 79 20 49 |;...{set| up by I|
|00001af0| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 09 67 47 6f 52 |nitializ|e}..gGoR|
|00001b00| 65 63 74 09 09 09 09 3a | 20 52 65 63 74 3b 09 09 |ect....:| Rect;..|
|00001b10| 09 7b 73 65 74 20 75 70 | 20 62 79 20 49 6e 69 74 |.{set up| by Init|
|00001b20| 69 61 6c 69 7a 65 7d 0d | 0d 0d 7b 24 53 20 49 6e |ialize}.|..{$S In|
|00001b30| 69 74 69 61 6c 69 7a 65 | 7d 0d 46 55 4e 43 54 49 |itialize|}.FUNCTI|
|00001b40| 4f 4e 20 54 72 61 70 41 | 76 61 69 6c 61 62 6c 65 |ON TrapA|vailable|
|00001b50| 28 74 4e 75 6d 62 65 72 | 3a 20 49 4e 54 45 47 45 |(tNumber|: INTEGE|
|00001b60| 52 3b 20 74 54 79 70 65 | 3a 20 54 72 61 70 54 79 |R; tType|: TrapTy|
|00001b70| 70 65 29 3a 20 42 4f 4f | 4c 45 41 4e 3b 0d 0d 7b |pe): BOO|LEAN;..{|
|00001b80| 43 68 65 63 6b 20 74 6f | 20 73 65 65 20 69 66 20 |Check to| see if |
|00001b90| 61 20 67 69 76 65 6e 20 | 74 72 61 70 20 69 73 20 |a given |trap is |
|00001ba0| 69 6d 70 6c 65 6d 65 6e | 74 65 64 2e 20 54 68 69 |implemen|ted. Thi|
|00001bb0| 73 20 69 73 20 6f 6e 6c | 79 20 75 73 65 64 20 62 |s is onl|y used b|
|00001bc0| 79 20 74 68 65 0d 20 49 | 6e 69 74 69 61 6c 69 7a |y the. I|nitializ|
|00001bd0| 65 20 72 6f 75 74 69 6e | 65 20 69 6e 20 74 68 69 |e routin|e in thi|
|00001be0| 73 20 70 72 6f 67 72 61 | 6d 2c 20 73 6f 20 77 65 |s progra|m, so we|
|00001bf0| 20 70 75 74 20 69 74 20 | 69 6e 20 74 68 65 20 49 | put it |in the I|
|00001c00| 6e 69 74 69 61 6c 69 7a | 65 20 73 65 67 6d 65 6e |nitializ|e segmen|
|00001c10| 74 2e 0d 20 54 68 65 20 | 72 65 63 6f 6d 6d 65 6e |t.. The |recommen|
|00001c20| 64 65 64 20 61 70 70 72 | 6f 61 63 68 20 74 6f 20 |ded appr|oach to |
|00001c30| 73 65 65 20 69 66 20 61 | 20 74 72 61 70 20 69 73 |see if a| trap is|
|00001c40| 20 69 6d 70 6c 65 6d 65 | 6e 74 65 64 20 69 73 20 | impleme|nted is |
|00001c50| 74 6f 20 73 65 65 20 69 | 66 0d 20 74 68 65 20 61 |to see i|f. the a|
|00001c60| 64 64 72 65 73 73 20 6f | 66 20 74 68 65 20 74 72 |ddress o|f the tr|
|00001c70| 61 70 20 72 6f 75 74 69 | 6e 65 20 69 73 20 74 68 |ap routi|ne is th|
|00001c80| 65 20 73 61 6d 65 20 61 | 73 20 74 68 65 20 61 64 |e same a|s the ad|
|00001c90| 64 72 65 73 73 20 6f 66 | 20 74 68 65 0d 20 55 6e |dress of| the. Un|
|00001ca0| 69 6d 70 6c 65 6d 65 6e | 74 65 64 20 74 72 61 70 |implemen|ted trap|
|00001cb0| 2e 7d 0d 0d 42 45 47 49 | 4e 0d 09 7b 43 68 65 63 |.}..BEGI|N..{Chec|
|00001cc0| 6b 20 61 6e 64 20 73 65 | 65 20 69 66 20 74 68 65 |k and se|e if the|
|00001cd0| 20 74 72 61 70 20 65 78 | 69 73 74 73 2e 20 4f 6e | trap ex|ists. On|
|00001ce0| 20 36 34 4b 20 52 4f 4d | 20 6d 61 63 68 69 6e 65 | 64K ROM| machine|
|00001cf0| 73 2c 20 74 54 79 70 65 | 20 77 69 6c 6c 20 62 65 |s, tType| will be|
|00001d00| 20 69 67 6e 6f 72 65 64 | 2e 7d 0d 0d 09 54 72 61 | ignored|.}...Tra|
|00001d10| 70 41 76 61 69 6c 61 62 | 6c 65 20 3a 3d 20 4e 47 |pAvailab|le := NG|
|00001d20| 65 74 54 72 61 70 41 64 | 64 72 65 73 73 28 74 4e |etTrapAd|dress(tN|
|00001d30| 75 6d 62 65 72 2c 20 74 | 54 79 70 65 29 20 3c 3e |umber, t|Type) <>|
|00001d40| 20 47 65 74 54 72 61 70 | 41 64 64 72 65 73 73 28 | GetTrap|Address(|
|00001d50| 5f 55 6e 69 6d 70 6c 65 | 6d 65 6e 74 65 64 29 3b |_Unimple|mented);|
|00001d60| 0d 45 4e 44 3b 20 7b 54 | 72 61 70 41 76 61 69 6c |.END; {T|rapAvail|
|00001d70| 61 62 6c 65 7d 0d 0d 0d | 7b 24 53 20 4d 61 69 6e |able}...|{$S Main|
|00001d80| 7d 0d 46 55 4e 43 54 49 | 4f 4e 20 49 73 44 41 57 |}.FUNCTI|ON IsDAW|
|00001d90| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 3a 20 57 69 |indow(wi|ndow: Wi|
|00001da0| 6e 64 6f 77 50 74 72 29 | 3a 20 42 4f 4f 4c 45 41 |ndowPtr)|: BOOLEA|
|00001db0| 4e 3b 0d 0d 7b 43 68 65 | 63 6b 20 69 66 20 61 20 |N;..{Che|ck if a |
|00001dc0| 77 69 6e 64 6f 77 20 62 | 65 6c 6f 6e 67 73 20 74 |window b|elongs t|
|00001dd0| 6f 20 61 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |o a desk| accesso|
|00001de0| 72 79 2e 7d 0d 0d 42 45 | 47 49 4e 0d 09 49 46 20 |ry.}..BE|GIN..IF |
|00001df0| 77 69 6e 64 6f 77 20 3d | 20 4e 49 4c 20 54 48 45 |window =| NIL THE|
|00001e00| 4e 0d 09 09 49 73 44 41 | 57 69 6e 64 6f 77 20 3a |N...IsDA|Window :|
|00001e10| 3d 20 46 41 4c 53 45 0d | 09 45 4c 53 45 09 7b 44 |= FALSE.|.ELSE.{D|
|00001e20| 41 20 77 69 6e 64 6f 77 | 73 20 68 61 76 65 20 6e |A window|s have n|
|00001e30| 65 67 61 74 69 76 65 20 | 77 69 6e 64 6f 77 4b 69 |egative |windowKi|
|00001e40| 6e 64 73 7d 0d 09 09 49 | 73 44 41 57 69 6e 64 6f |nds}...I|sDAWindo|
|00001e50| 77 20 3a 3d 20 57 69 6e | 64 6f 77 50 65 65 6b 28 |w := Win|dowPeek(|
|00001e60| 77 69 6e 64 6f 77 29 5e | 2e 77 69 6e 64 6f 77 4b |window)^|.windowK|
|00001e70| 69 6e 64 20 3c 20 30 3b | 0d 45 4e 44 3b 20 7b 49 |ind < 0;|.END; {I|
|00001e80| 73 44 41 57 69 6e 64 6f | 77 7d 0d 0d 0d 7b 24 53 |sDAWindo|w}...{$S|
|00001e90| 20 4d 61 69 6e 7d 0d 46 | 55 4e 43 54 49 4f 4e 20 | Main}.F|UNCTION |
|00001ea0| 49 73 41 70 70 57 69 6e | 64 6f 77 28 77 69 6e 64 |IsAppWin|dow(wind|
|00001eb0| 6f 77 3a 20 57 69 6e 64 | 6f 77 50 74 72 29 3a 20 |ow: Wind|owPtr): |
|00001ec0| 42 4f 4f 4c 45 41 4e 3b | 0d 0d 7b 43 68 65 63 6b |BOOLEAN;|..{Check|
|00001ed0| 20 74 6f 20 73 65 65 20 | 69 66 20 61 20 77 69 6e | to see |if a win|
|00001ee0| 64 6f 77 20 62 65 6c 6f | 6e 67 73 20 74 6f 20 74 |dow belo|ngs to t|
|00001ef0| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2e 20 |he appli|cation. |
|00001f00| 49 66 20 74 68 65 20 77 | 69 6e 64 6f 77 20 70 6f |If the w|indow po|
|00001f10| 69 6e 74 65 72 0d 20 70 | 61 73 73 65 64 20 77 61 |inter. p|assed wa|
|00001f20| 73 20 4e 49 4c 2c 20 74 | 68 65 6e 20 69 74 20 63 |s NIL, t|hen it c|
|00001f30| 6f 75 6c 64 20 6e 6f 74 | 20 62 65 20 61 6e 20 61 |ould not| be an a|
|00001f40| 70 70 6c 69 63 61 74 69 | 6f 6e 20 77 69 6e 64 6f |pplicati|on windo|
|00001f50| 77 2e 20 57 69 6e 64 6f | 77 4b 69 6e 64 73 0d 20 |w. Windo|wKinds. |
|00001f60| 74 68 61 74 20 61 72 65 | 20 6e 65 67 61 74 69 76 |that are| negativ|
|00001f70| 65 20 62 65 6c 6f 6e 67 | 20 74 6f 20 74 68 65 20 |e belong| to the |
|00001f80| 73 79 73 74 65 6d 20 61 | 6e 64 20 77 69 6e 64 6f |system a|nd windo|
|00001f90| 77 4b 69 6e 64 73 20 6c | 65 73 73 20 74 68 61 6e |wKinds l|ess than|
|00001fa0| 20 75 73 65 72 4b 69 6e | 64 0d 20 61 72 65 20 72 | userKin|d. are r|
|00001fb0| 65 73 65 72 76 65 64 20 | 62 79 20 41 70 70 6c 65 |eserved |by Apple|
|00001fc0| 20 65 78 63 65 70 74 20 | 66 6f 72 20 77 69 6e 64 | except |for wind|
|00001fd0| 6f 77 4b 69 6e 64 73 20 | 65 71 75 61 6c 20 74 6f |owKinds |equal to|
|00001fe0| 20 64 69 61 6c 6f 67 4b | 69 6e 64 2c 20 77 68 69 | dialogK|ind, whi|
|00001ff0| 63 68 0d 20 6d 65 61 6e | 20 69 74 20 69 73 20 61 |ch. mean| it is a|
|00002000| 20 64 69 61 6c 6f 67 2e | 7d 0d 0d 42 45 47 49 4e | dialog.|}..BEGIN|
|00002010| 0d 09 49 46 20 77 69 6e | 64 6f 77 20 3d 20 4e 49 |..IF win|dow = NI|
|00002020| 4c 20 54 48 45 4e 0d 09 | 09 49 73 41 70 70 57 69 |L THEN..|.IsAppWi|
|00002030| 6e 64 6f 77 20 3a 3d 20 | 46 41 4c 53 45 0d 09 45 |ndow := |FALSE..E|
|00002040| 4c 53 45 09 7b 61 70 70 | 6c 69 63 61 74 69 6f 6e |LSE.{app|lication|
|00002050| 20 77 69 6e 64 6f 77 73 | 20 68 61 76 65 20 77 69 | windows| have wi|
|00002060| 6e 64 6f 77 4b 69 6e 64 | 73 20 3e 3d 20 75 73 65 |ndowKind|s >= use|
|00002070| 72 4b 69 6e 64 20 28 38 | 29 20 6f 72 20 64 69 61 |rKind (8|) or dia|
|00002080| 6c 6f 67 4b 69 6e 64 20 | 28 32 29 7d 0d 09 09 57 |logKind |(2)}...W|
|00002090| 49 54 48 20 57 69 6e 64 | 6f 77 50 65 65 6b 28 77 |ITH Wind|owPeek(w|
|000020a0| 69 6e 64 6f 77 29 5e 20 | 44 4f 0d 09 09 09 49 73 |indow)^ |DO....Is|
|000020b0| 41 70 70 57 69 6e 64 6f | 77 20 3a 3d 20 28 77 69 |AppWindo|w := (wi|
|000020c0| 6e 64 6f 77 4b 69 6e 64 | 20 3e 3d 20 75 73 65 72 |ndowKind| >= user|
|000020d0| 4b 69 6e 64 29 20 7c 20 | 28 77 69 6e 64 6f 77 4b |Kind) | |(windowK|
|000020e0| 69 6e 64 20 3d 20 64 69 | 61 6c 6f 67 4b 69 6e 64 |ind = di|alogKind|
|000020f0| 29 3b 0d 45 4e 44 3b 20 | 7b 49 73 41 70 70 57 69 |);.END; |{IsAppWi|
|00002100| 6e 64 6f 77 7d 0d 0d 0d | 7b 24 53 20 4d 61 69 6e |ndow}...|{$S Main|
|00002110| 7d 0d 50 52 4f 43 45 44 | 55 52 45 20 41 6c 65 72 |}.PROCED|URE Aler|
|00002120| 74 55 73 65 72 3b 0d 0d | 7b 44 69 73 70 6c 61 79 |tUser;..|{Display|
|00002130| 20 61 6e 20 61 6c 65 72 | 74 20 74 68 61 74 20 74 | an aler|t that t|
|00002140| 65 6c 6c 73 20 74 68 65 | 20 75 73 65 72 20 61 6e |ells the| user an|
|00002150| 20 65 72 72 6f 72 20 6f | 63 63 75 72 72 65 64 2c | error o|ccurred,|
|00002160| 20 74 68 65 6e 20 65 78 | 69 74 20 74 68 65 20 70 | then ex|it the p|
|00002170| 72 6f 67 72 61 6d 2e 0d | 20 54 68 69 73 20 72 6f |rogram..| This ro|
|00002180| 75 74 69 6e 65 20 69 73 | 20 75 73 65 64 20 61 73 |utine is| used as|
|00002190| 20 61 6e 20 75 6c 74 69 | 6d 61 74 65 20 62 61 69 | an ulti|mate bai|
|000021a0| 6c 2d 6f 75 74 20 66 6f | 72 20 73 65 72 69 6f 75 |l-out fo|r seriou|
|000021b0| 73 20 65 72 72 6f 72 73 | 20 74 68 61 74 20 70 72 |s errors| that pr|
|000021c0| 6f 68 69 62 69 74 0d 20 | 74 68 65 20 63 6f 6e 74 |ohibit. |the cont|
|000021d0| 69 6e 75 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |inuation| of the |
|000021e0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 20 45 72 72 |applicat|ion. Err|
|000021f0| 6f 72 73 20 74 68 61 74 | 20 64 6f 20 6e 6f 74 20 |ors that| do not |
|00002200| 72 65 71 75 69 72 65 20 | 74 68 65 20 74 65 72 6d |require |the term|
|00002210| 69 6e 61 74 69 6f 6e 0d | 20 6f 66 20 74 68 65 20 |ination.| of the |
|00002220| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 73 68 6f 75 |applicat|ion shou|
|00002230| 6c 64 20 62 65 20 68 61 | 6e 64 6c 65 64 20 69 6e |ld be ha|ndled in|
|00002240| 20 61 20 64 69 66 66 65 | 72 65 6e 74 20 6d 61 6e | a diffe|rent man|
|00002250| 6e 65 72 2e 20 45 72 72 | 6f 72 20 63 68 65 63 6b |ner. Err|or check|
|00002260| 69 6e 67 20 61 6e 64 0d | 20 72 65 70 6f 72 74 69 |ing and.| reporti|
|00002270| 6e 67 20 68 61 73 20 61 | 20 70 6c 61 63 65 20 65 |ng has a| place e|
|00002280| 76 65 6e 20 69 6e 20 74 | 68 65 20 73 69 6d 70 6c |ven in t|he simpl|
|00002290| 65 73 74 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |est appl|ication.|
|000022a0| 20 46 6f 72 20 73 69 6d | 70 6c 69 63 69 74 79 2c | For sim|plicity,|
|000022b0| 20 74 68 65 20 61 6c 65 | 72 74 0d 20 64 69 73 70 | the ale|rt. disp|
|000022c0| 6c 61 79 65 64 20 68 65 | 72 65 20 6f 6e 6c 79 20 |layed he|re only |
|000022d0| 73 61 79 73 20 74 68 61 | 74 20 61 6e 20 65 72 72 |says tha|t an err|
|000022e0| 6f 72 20 6f 63 63 75 72 | 72 65 64 2c 20 62 75 74 |or occur|red, but|
|000022f0| 20 6e 6f 74 20 77 68 61 | 74 20 69 74 20 77 61 73 | not wha|t it was|
|00002300| 2e 20 54 68 65 72 65 20 | 61 72 65 0d 20 76 61 72 |. There |are. var|
|00002310| 69 6f 75 73 20 6d 65 74 | 68 6f 64 73 20 61 76 61 |ious met|hods ava|
|00002320| 69 6c 61 62 6c 65 20 66 | 6f 72 20 62 65 69 6e 67 |ilable f|or being|
|00002330| 20 6d 6f 72 65 20 73 70 | 65 63 69 66 69 63 2e 7d | more sp|ecific.}|
|00002340| 0d 20 0d 56 41 52 0d 09 | 69 74 65 6d 48 69 74 09 |. .VAR..|itemHit.|
|00002350| 3a 20 49 4e 54 45 47 45 | 52 3b 0d 42 45 47 49 4e |: INTEGE|R;.BEGIN|
|00002360| 0d 09 53 65 74 43 75 72 | 73 6f 72 28 61 72 72 6f |..SetCur|sor(arro|
|00002370| 77 29 3b 0d 09 69 74 65 | 6d 48 69 74 20 3a 3d 20 |w);..ite|mHit := |
|00002380| 41 6c 65 72 74 28 72 55 | 73 65 72 41 6c 65 72 74 |Alert(rU|serAlert|
|00002390| 2c 20 4e 49 4c 29 3b 0d | 09 45 78 69 74 54 6f 53 |, NIL);.|.ExitToS|
|000023a0| 68 65 6c 6c 3b 0d 45 4e | 44 3b 20 7b 41 6c 65 72 |hell;.EN|D; {Aler|
|000023b0| 74 55 73 65 72 7d 0d 0d | 0d 7b 24 53 20 4d 61 69 |tUser}..|.{$S Mai|
|000023c0| 6e 7d 0d 46 55 4e 43 54 | 49 4f 4e 20 44 6f 43 6c |n}.FUNCT|ION DoCl|
|000023d0| 6f 73 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oseWindo|w(window|
|000023e0| 3a 20 57 69 6e 64 6f 77 | 50 74 72 29 20 3a 20 42 |: Window|Ptr) : B|
|000023f0| 4f 4f 4c 45 41 4e 3b 0d | 0d 7b 43 6c 6f 73 65 20 |OOLEAN;.|.{Close |
|00002400| 61 20 77 69 6e 64 6f 77 | 2e 7d 0d 0d 7b 31 2e 30 |a window|.}..{1.0|
|00002410| 31 20 2d 20 41 74 20 74 | 68 69 73 20 70 6f 69 6e |1 - At t|his poin|
|00002420| 74 2c 20 69 66 20 74 68 | 65 72 65 20 77 61 73 20 |t, if th|ere was |
|00002430| 61 20 64 6f 63 75 6d 65 | 6e 74 20 61 73 73 6f 63 |a docume|nt assoc|
|00002440| 69 61 74 65 64 20 77 69 | 74 68 20 61 0d 20 77 69 |iated wi|th a. wi|
|00002450| 6e 64 6f 77 2c 20 79 6f | 75 20 63 6f 75 6c 64 20 |ndow, yo|u could |
|00002460| 64 6f 20 61 6e 79 20 64 | 6f 63 75 6d 65 6e 74 20 |do any d|ocument |
|00002470| 73 61 76 69 6e 67 20 70 | 72 6f 63 65 73 73 69 6e |saving p|rocessin|
|00002480| 67 20 69 66 20 69 74 20 | 69 73 20 27 64 69 72 74 |g if it |is 'dirt|
|00002490| 79 27 2e 0d 20 44 6f 43 | 6c 6f 73 65 57 69 6e 64 |y'.. DoC|loseWind|
|000024a0| 6f 77 20 77 6f 75 6c 64 | 20 72 65 74 75 72 6e 20 |ow would| return |
|000024b0| 54 52 55 45 20 69 66 20 | 74 68 65 20 77 69 6e 64 |TRUE if |the wind|
|000024c0| 6f 77 20 61 63 74 75 61 | 6c 6c 79 20 63 6c 6f 73 |ow actua|lly clos|
|000024d0| 65 73 2c 20 69 2e 65 2e | 2c 0d 20 74 68 65 20 75 |es, i.e.|,. the u|
|000024e0| 73 65 72 20 64 6f 65 73 | 20 6e 6f 74 20 63 61 6e |ser does| not can|
|000024f0| 63 65 6c 20 66 72 6f 6d | 20 61 20 73 61 76 65 20 |cel from| a save |
|00002500| 64 69 61 6c 6f 67 2e 20 | 54 68 69 73 20 72 65 73 |dialog. |This res|
|00002510| 75 6c 74 20 69 73 20 68 | 61 6e 64 79 20 77 68 65 |ult is h|andy whe|
|00002520| 6e 0d 20 74 68 65 20 75 | 73 65 72 20 71 75 69 74 |n. the u|ser quit|
|00002530| 73 20 61 6e 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |s an app|lication|
|00002540| 2c 20 62 75 74 20 74 68 | 65 6e 20 63 61 6e 63 65 |, but th|en cance|
|00002550| 6c 73 20 61 20 73 61 76 | 65 20 6f 66 20 61 20 64 |ls a sav|e of a d|
|00002560| 6f 63 75 6d 65 6e 74 0d | 20 61 73 73 6f 63 69 61 |ocument.| associa|
|00002570| 74 65 64 20 77 69 74 68 | 20 61 20 77 69 6e 64 6f |ted with| a windo|
|00002580| 77 2e 20 57 65 20 61 6c | 73 6f 20 61 64 64 65 64 |w. We al|so added|
|00002590| 20 63 6f 64 65 20 74 6f | 20 63 6c 6f 73 65 20 74 | code to| close t|
|000025a0| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 0d 20 |he appli|cation. |
|000025b0| 77 69 6e 64 6f 77 20 73 | 69 6e 63 65 20 6f 74 68 |window s|ince oth|
|000025c0| 65 72 77 69 73 65 2c 20 | 74 68 65 20 74 65 72 6d |erwise, |the term|
|000025d0| 69 6e 61 74 69 6f 6e 20 | 72 6f 75 74 69 6e 65 73 |ination |routines|
|000025e0| 20 77 6f 75 6c 64 20 6e | 65 76 65 72 20 73 74 6f | would n|ever sto|
|000025f0| 70 20 6c 6f 6f 70 69 6e | 67 2c 0d 20 77 61 69 74 |p loopin|g,. wait|
|00002600| 69 6e 67 20 66 6f 72 20 | 46 72 6f 6e 74 57 69 6e |ing for |FrontWin|
|00002610| 64 6f 77 20 74 6f 20 72 | 65 74 75 72 6e 20 4e 49 |dow to r|eturn NI|
|00002620| 4c 2e 7d 0d 0d 42 45 47 | 49 4e 0d 09 44 6f 43 6c |L.}..BEG|IN..DoCl|
|00002630| 6f 73 65 57 69 6e 64 6f | 77 20 3a 3d 20 54 52 55 |oseWindo|w := TRU|
|00002640| 45 3b 0d 09 49 46 20 49 | 73 44 41 57 69 6e 64 6f |E;..IF I|sDAWindo|
|00002650| 77 28 77 69 6e 64 6f 77 | 29 20 54 48 45 4e 0d 09 |w(window|) THEN..|
|00002660| 09 43 6c 6f 73 65 44 65 | 73 6b 41 63 63 28 57 69 |.CloseDe|skAcc(Wi|
|00002670| 6e 64 6f 77 50 65 65 6b | 28 77 69 6e 64 6f 77 29 |ndowPeek|(window)|
|00002680| 5e 2e 77 69 6e 64 6f 77 | 4b 69 6e 64 29 3b 0d 09 |^.window|Kind);..|
|00002690| 49 46 20 49 73 41 70 70 | 57 69 6e 64 6f 77 28 77 |IF IsApp|Window(w|
|000026a0| 69 6e 64 6f 77 29 20 54 | 48 45 4e 0d 09 09 43 6c |indow) T|HEN...Cl|
|000026b0| 6f 73 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oseWindo|w(window|
|000026c0| 29 3b 0d 45 4e 44 3b 20 | 7b 44 6f 43 6c 6f 73 65 |);.END; |{DoClose|
|000026d0| 57 69 6e 64 6f 77 7d 0d | 0d 0d 7b 24 53 20 49 6e |Window}.|..{$S In|
|000026e0| 69 74 69 61 6c 69 7a 65 | 7d 0d 46 55 4e 43 54 49 |itialize|}.FUNCTI|
|000026f0| 4f 4e 20 47 6f 47 65 74 | 52 65 63 74 28 72 65 63 |ON GoGet|Rect(rec|
|00002700| 74 49 44 3a 20 49 4e 54 | 45 47 45 52 3b 20 56 41 |tID: INT|EGER; VA|
|00002710| 52 20 74 68 65 52 65 63 | 74 3a 20 52 65 63 74 29 |R theRec|t: Rect)|
|00002720| 20 3a 20 42 4f 4f 4c 45 | 41 4e 3b 0d 20 0d 7b 54 | : BOOLE|AN;. .{T|
|00002730| 68 69 73 20 75 74 69 6c | 69 74 79 20 6c 6f 61 64 |his util|ity load|
|00002740| 73 20 74 68 65 20 67 6c | 6f 62 61 6c 20 72 65 63 |s the gl|obal rec|
|00002750| 74 61 6e 67 6c 65 73 20 | 74 68 61 74 20 61 72 65 |tangles |that are|
|00002760| 20 75 73 65 64 20 62 79 | 20 74 68 65 20 77 69 6e | used by| the win|
|00002770| 64 6f 77 0d 20 64 72 61 | 77 69 6e 67 20 72 6f 75 |dow. dra|wing rou|
|00002780| 74 69 6e 65 73 2e 20 49 | 74 20 73 68 6f 77 73 20 |tines. I|t shows |
|00002790| 68 6f 77 20 74 68 65 20 | 72 65 73 6f 75 72 63 65 |how the |resource|
|000027a0| 20 6d 61 6e 61 67 65 72 | 20 63 61 6e 20 62 65 20 | manager| can be |
|000027b0| 75 73 65 64 20 74 6f 20 | 68 6f 6c 64 0d 20 76 61 |used to |hold. va|
|000027c0| 6c 75 65 73 20 69 6e 20 | 61 20 63 6f 6e 76 65 6e |lues in |a conven|
|000027d0| 69 65 6e 74 20 6d 61 6e | 6e 65 72 2e 20 54 68 65 |ient man|ner. The|
|000027e0| 73 65 20 76 61 6c 75 65 | 73 20 61 72 65 20 74 68 |se value|s are th|
|000027f0| 65 6e 20 65 61 73 69 6c | 79 20 61 6c 74 65 72 65 |en easil|y altere|
|00002800| 64 20 77 69 74 68 6f 75 | 74 0d 20 68 61 76 69 6e |d withou|t. havin|
|00002810| 67 20 74 6f 20 72 65 2d | 63 6f 6d 70 69 6c 65 20 |g to re-|compile |
|00002820| 74 68 65 20 73 6f 75 72 | 63 65 20 63 6f 64 65 2e |the sour|ce code.|
|00002830| 20 49 6e 20 74 68 69 73 | 20 70 61 72 74 69 63 75 | In this| particu|
|00002840| 6c 61 72 20 63 61 73 65 | 2c 20 77 65 20 6b 6e 6f |lar case|, we kno|
|00002850| 77 0d 20 74 68 61 74 20 | 74 68 69 73 20 72 6f 75 |w. that |this rou|
|00002860| 74 69 6e 65 20 69 73 20 | 62 65 69 6e 67 20 63 61 |tine is |being ca|
|00002870| 6c 6c 65 64 20 61 74 20 | 69 6e 69 74 69 61 6c 69 |lled at |initiali|
|00002880| 7a 61 74 69 6f 6e 20 74 | 69 6d 65 2e 20 54 68 65 |zation t|ime. The|
|00002890| 72 65 66 6f 72 65 2c 0d | 20 69 66 20 74 68 69 73 |refore,.| if this|
|000028a0| 20 72 65 74 75 72 6e 73 | 20 46 41 4c 53 45 2c 20 | returns| FALSE, |
|000028b0| 77 65 20 77 69 6c 6c 20 | 61 73 73 75 6d 65 20 74 |we will |assume t|
|000028c0| 68 61 74 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |hat the |applicat|
|000028d0| 69 6f 6e 20 69 73 20 69 | 6e 20 73 75 63 68 0d 20 |ion is i|n such. |
|000028e0| 62 61 64 20 73 68 61 70 | 65 20 74 68 61 74 20 77 |bad shap|e that w|
|000028f0| 65 20 73 68 6f 75 6c 64 | 20 6a 75 73 74 20 65 78 |e should| just ex|
|00002900| 69 74 2e 20 59 6f 75 72 | 20 65 72 72 6f 72 20 68 |it. Your| error h|
|00002910| 61 6e 64 6c 69 6e 67 20 | 6d 61 79 20 64 69 66 66 |andling |may diff|
|00002920| 65 72 2c 20 62 75 74 0d | 20 74 68 65 20 63 68 65 |er, but.| the che|
|00002930| 63 6b 20 73 68 6f 75 6c | 64 20 73 74 69 6c 6c 20 |ck shoul|d still |
|00002940| 62 65 20 6d 61 64 65 2e | 7d 0d 0d 7b 31 2e 30 31 |be made.|}..{1.01|
|00002950| 20 2d 20 43 68 61 6e 67 | 65 64 20 47 6f 47 65 74 | - Chang|ed GoGet|
|00002960| 52 65 63 74 20 74 6f 20 | 72 65 74 75 72 6e 20 61 |Rect to |return a|
|00002970| 20 42 4f 4f 4c 45 41 4e | 20 74 68 61 74 20 69 6e | BOOLEAN| that in|
|00002980| 64 69 63 61 74 65 73 20 | 69 66 20 69 74 20 77 61 |dicates |if it wa|
|00002990| 73 20 73 75 63 63 65 73 | 73 66 75 6c 0d 20 69 6e |s succes|sful. in|
|000029a0| 20 67 65 74 74 69 6e 67 | 20 74 68 65 20 72 65 63 | getting| the rec|
|000029b0| 74 61 6e 67 6c 65 20 72 | 61 74 68 65 72 20 74 68 |tangle r|ather th|
|000029c0| 61 6e 20 6a 75 73 74 20 | 64 6f 69 6e 67 20 45 78 |an just |doing Ex|
|000029d0| 69 74 54 6f 53 68 65 6c | 6c 2e 7d 0d 20 0d 54 59 |itToShel|l.}. .TY|
|000029e0| 50 45 0d 09 52 65 63 74 | 50 74 72 09 09 3d 20 5e |PE..Rect|Ptr..= ^|
|000029f0| 52 65 63 74 3b 0d 09 52 | 65 63 74 48 6e 64 09 09 |Rect;..R|ectHnd..|
|00002a00| 3d 20 5e 52 65 63 74 50 | 74 72 3b 0d 56 41 52 0d |= ^RectP|tr;.VAR.|
|00002a10| 09 72 65 73 6f 75 72 63 | 65 09 3a 20 48 61 6e 64 |.resourc|e.: Hand|
|00002a20| 6c 65 3b 0d 42 45 47 49 | 4e 0d 09 72 65 73 6f 75 |le;.BEGI|N..resou|
|00002a30| 72 63 65 20 3a 3d 20 47 | 65 74 52 65 73 6f 75 72 |rce := G|etResour|
|00002a40| 63 65 28 27 52 45 43 54 | 27 2c 20 72 65 63 74 49 |ce('RECT|', rectI|
|00002a50| 44 29 3b 0d 09 49 46 20 | 72 65 73 6f 75 72 63 65 |D);..IF |resource|
|00002a60| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 20 42 45 47 | <> NIL |THEN BEG|
|00002a70| 49 4e 0d 09 09 47 6f 47 | 65 74 52 65 63 74 20 3a |IN...GoG|etRect :|
|00002a80| 3d 20 54 52 55 45 3b 0d | 09 09 74 68 65 52 65 63 |= TRUE;.|..theRec|
|00002a90| 74 20 3a 3d 20 52 65 63 | 74 48 6e 64 28 72 65 73 |t := Rec|tHnd(res|
|00002aa0| 6f 75 72 63 65 29 5e 5e | 3b 0d 09 09 45 4e 44 0d |ource)^^|;...END.|
|00002ab0| 09 45 4c 53 45 0d 09 09 | 47 6f 47 65 74 52 65 63 |.ELSE...|GoGetRec|
|00002ac0| 74 20 3a 3d 20 46 41 4c | 53 45 3b 0d 45 4e 44 3b |t := FAL|SE;.END;|
|00002ad0| 20 7b 47 6f 47 65 74 52 | 65 63 74 7d 0d 0d 0d 7b | {GoGetR|ect}...{|
|00002ae0| 24 53 20 49 6e 69 74 69 | 61 6c 69 7a 65 7d 0d 50 |$S Initi|alize}.P|
|00002af0| 52 4f 43 45 44 55 52 45 | 20 49 6e 69 74 69 61 6c |ROCEDURE| Initial|
|00002b00| 69 7a 65 3b 0d 0d 7b 53 | 65 74 20 75 70 20 74 68 |ize;..{S|et up th|
|00002b10| 65 20 77 68 6f 6c 65 20 | 77 6f 72 6c 64 2c 20 69 |e whole |world, i|
|00002b20| 6e 63 6c 75 64 69 6e 67 | 20 67 6c 6f 62 61 6c 20 |ncluding| global |
|00002b30| 76 61 72 69 61 62 6c 65 | 73 2c 20 54 6f 6f 6c 62 |variable|s, Toolb|
|00002b40| 6f 78 20 6d 61 6e 61 67 | 65 72 73 2c 0d 20 61 6e |ox manag|ers,. an|
|00002b50| 64 20 6d 65 6e 75 73 2e | 20 57 65 20 61 6c 73 6f |d menus.| We also|
|00002b60| 20 63 72 65 61 74 65 20 | 6f 75 72 20 6f 6e 65 20 | create |our one |
|00002b70| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 77 69 6e 64 |applicat|ion wind|
|00002b80| 6f 77 20 61 74 20 74 68 | 69 73 20 74 69 6d 65 2e |ow at th|is time.|
|00002b90| 0d 20 53 69 6e 63 65 20 | 77 69 6e 64 6f 77 20 73 |. Since |window s|
|00002ba0| 74 6f 72 61 67 65 20 69 | 73 20 6e 6f 6e 2d 72 65 |torage i|s non-re|
|00002bb0| 6c 6f 63 61 74 65 61 62 | 6c 65 2c 20 68 6f 77 20 |locateab|le, how |
|00002bc0| 61 6e 64 20 77 68 65 6e | 20 74 6f 20 61 6c 6c 6f |and when| to allo|
|00002bd0| 63 61 74 65 20 73 70 61 | 63 65 0d 20 66 6f 72 20 |cate spa|ce. for |
|00002be0| 77 69 6e 64 6f 77 73 20 | 69 73 20 76 65 72 79 20 |windows |is very |
|00002bf0| 69 6d 70 6f 72 74 61 6e | 74 20 73 6f 20 74 68 61 |importan|t so tha|
|00002c00| 74 20 68 65 61 70 20 66 | 72 61 67 6d 65 6e 74 61 |t heap f|ragmenta|
|00002c10| 74 69 6f 6e 20 64 6f 65 | 73 20 6e 6f 74 20 6f 63 |tion doe|s not oc|
|00002c20| 63 75 72 2e 0d 20 42 65 | 63 61 75 73 65 20 53 61 |cur.. Be|cause Sa|
|00002c30| 6d 70 6c 65 20 68 61 73 | 20 6f 6e 6c 79 20 6f 6e |mple has| only on|
|00002c40| 65 20 77 69 6e 64 6f 77 | 20 61 6e 64 20 69 74 20 |e window| and it |
|00002c50| 69 73 20 6f 6e 6c 79 20 | 64 69 73 70 6f 73 65 64 |is only |disposed|
|00002c60| 20 77 68 65 6e 20 74 68 | 65 20 61 70 70 6c 69 63 | when th|e applic|
|00002c70| 61 74 69 6f 6e 0d 20 71 | 75 69 74 73 2c 20 77 65 |ation. q|uits, we|
|00002c80| 20 77 69 6c 6c 20 61 6c | 6c 6f 63 61 74 65 20 69 | will al|locate i|
|00002c90| 74 73 20 73 70 61 63 65 | 20 68 65 72 65 2c 20 62 |ts space| here, b|
|00002ca0| 65 66 6f 72 65 20 61 6e | 79 74 68 69 6e 67 20 74 |efore an|ything t|
|00002cb0| 68 61 74 20 6d 69 67 68 | 74 20 62 65 20 61 20 6c |hat migh|t be a l|
|00002cc0| 6f 63 6b 65 64 0d 20 72 | 65 6c 6f 63 61 74 61 62 |ocked. r|elocatab|
|00002cd0| 6c 65 20 6f 62 6a 65 63 | 74 20 67 65 74 73 20 69 |le objec|t gets i|
|00002ce0| 6e 74 6f 20 74 68 65 20 | 68 65 61 70 2e 20 54 68 |nto the |heap. Th|
|00002cf0| 69 73 20 77 61 79 2c 20 | 77 65 20 63 61 6e 20 66 |is way, |we can f|
|00002d00| 6f 72 63 65 20 69 74 73 | 20 73 74 6f 72 61 67 65 |orce its| storage|
|00002d10| 20 74 6f 20 62 65 0d 20 | 69 6e 20 74 68 65 20 6c | to be. |in the l|
|00002d20| 6f 77 65 73 74 20 6d 65 | 6d 6f 72 79 20 61 76 61 |owest me|mory ava|
|00002d30| 69 6c 61 62 6c 65 20 69 | 6e 20 74 68 65 20 68 65 |ilable i|n the he|
|00002d40| 61 70 2e 20 57 69 6e 64 | 6f 77 20 73 74 6f 72 61 |ap. Wind|ow stora|
|00002d50| 67 65 20 63 61 6e 20 64 | 69 66 66 65 72 20 77 69 |ge can d|iffer wi|
|00002d60| 64 65 6c 79 0d 20 61 6d | 6f 6e 67 73 74 20 61 70 |dely. am|ongst ap|
|00002d70| 70 6c 69 63 61 74 69 6f | 6e 73 20 64 65 70 65 6e |plicatio|ns depen|
|00002d80| 64 69 6e 67 20 6f 6e 20 | 68 6f 77 20 6d 61 6e 79 |ding on |how many|
|00002d90| 20 77 69 6e 64 6f 77 73 | 20 61 72 65 20 63 72 65 | windows| are cre|
|00002da0| 61 74 65 64 20 61 6e 64 | 20 64 69 73 70 6f 73 65 |ated and| dispose|
|00002db0| 64 2e 0d 20 49 66 20 61 | 20 66 61 69 6c 75 72 65 |d.. If a| failure|
|00002dc0| 20 6f 63 63 75 72 73 20 | 68 65 72 65 2c 20 77 65 | occurs |here, we|
|00002dd0| 20 77 69 6c 6c 20 63 6f | 6e 73 69 64 65 72 20 74 | will co|nsider t|
|00002de0| 68 61 74 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |hat the |applicat|
|00002df0| 69 6f 6e 20 69 73 20 69 | 6e 20 73 75 63 68 0d 20 |ion is i|n such. |
|00002e00| 62 61 64 20 73 68 61 70 | 65 20 74 68 61 74 20 77 |bad shap|e that w|
|00002e10| 65 20 73 68 6f 75 6c 64 | 20 6a 75 73 74 20 65 78 |e should| just ex|
|00002e20| 69 74 2e 20 59 6f 75 72 | 20 65 72 72 6f 72 20 68 |it. Your| error h|
|00002e30| 61 6e 64 6c 69 6e 67 20 | 6d 61 79 20 64 69 66 66 |andling |may diff|
|00002e40| 65 72 2c 20 62 75 74 0d | 20 74 68 65 20 63 68 65 |er, but.| the che|
|00002e50| 63 6b 73 20 73 68 6f 75 | 6c 64 20 73 74 69 6c 6c |cks shou|ld still|
|00002e60| 20 62 65 20 6d 61 64 65 | 2e 7d 0d 20 0d 7b 31 2e | be made|.}. .{1.|
|00002e70| 30 31 20 2d 20 54 68 65 | 20 63 6f 64 65 20 74 68 |01 - The| code th|
|00002e80| 61 74 20 75 73 65 64 20 | 74 6f 20 62 65 20 70 61 |at used |to be pa|
|00002e90| 72 74 20 6f 66 20 46 6f | 72 63 65 45 6e 76 69 72 |rt of Fo|rceEnvir|
|00002ea0| 6f 6e 73 20 68 61 73 20 | 62 65 65 6e 20 6d 6f 76 |ons has |been mov|
|00002eb0| 65 64 20 69 6e 74 6f 0d | 20 74 68 69 73 20 6d 6f |ed into.| this mo|
|00002ec0| 64 75 6c 65 2e 20 49 66 | 20 61 6e 20 65 72 72 6f |dule. If| an erro|
|00002ed0| 72 20 69 73 20 64 65 74 | 65 63 74 65 64 2c 20 69 |r is det|ected, i|
|00002ee0| 6e 73 74 65 61 64 20 6f | 66 20 6d 65 72 65 6c 79 |nstead o|f merely|
|00002ef0| 20 64 6f 69 6e 67 20 61 | 6e 20 45 78 69 74 54 6f | doing a|n ExitTo|
|00002f00| 53 68 65 6c 6c 2c 0d 20 | 77 68 69 63 68 20 6c 65 |Shell,. |which le|
|00002f10| 61 76 65 73 20 74 68 65 | 20 75 73 65 72 20 77 69 |aves the| user wi|
|00002f20| 74 68 6f 75 74 20 6d 75 | 63 68 20 74 6f 20 67 6f |thout mu|ch to go|
|00002f30| 20 6f 6e 2c 20 77 65 20 | 63 61 6c 6c 20 41 6c 65 | on, we |call Ale|
|00002f40| 72 74 55 73 65 72 2c 20 | 77 68 69 63 68 20 70 75 |rtUser, |which pu|
|00002f50| 74 73 0d 20 75 70 20 61 | 20 73 69 6d 70 6c 65 20 |ts. up a| simple |
|00002f60| 61 6c 65 72 74 20 74 68 | 61 74 20 6a 75 73 74 20 |alert th|at just |
|00002f70| 73 61 79 73 20 61 6e 20 | 65 72 72 6f 72 20 6f 63 |says an |error oc|
|00002f80| 63 75 72 72 65 64 20 61 | 6e 64 20 74 68 65 6e 20 |curred a|nd then |
|00002f90| 63 61 6c 6c 73 20 45 78 | 69 74 54 6f 53 68 65 6c |calls Ex|itToShel|
|00002fa0| 6c 2e 0d 20 49 6e 20 74 | 68 65 20 69 6e 74 65 72 |l.. In t|he inter|
|00002fb0| 65 73 74 73 20 6f 66 20 | 6b 65 65 70 69 6e 67 20 |ests of |keeping |
|00002fc0| 74 68 69 6e 67 73 20 73 | 69 6d 70 6c 65 2c 20 74 |things s|imple, t|
|00002fd0| 68 65 20 61 6c 65 72 74 | 20 64 6f 65 73 20 6e 6f |he alert| does no|
|00002fe0| 74 20 73 74 61 74 65 20 | 74 68 65 20 73 70 65 63 |t state |the spec|
|00002ff0| 69 66 69 63 0d 20 63 61 | 75 73 65 20 6f 66 20 74 |ific. ca|use of t|
|00003000| 68 65 20 65 72 72 6f 72 | 2c 20 62 75 74 20 61 20 |he error|, but a |
|00003010| 6d 6f 72 65 20 69 6e 66 | 6f 72 6d 61 74 69 76 65 |more inf|ormative|
|00003020| 20 61 6c 65 72 74 20 77 | 6f 75 6c 64 20 62 65 20 | alert w|ould be |
|00003030| 61 70 70 72 6f 70 72 69 | 61 74 65 20 66 6f 72 20 |appropri|ate for |
|00003040| 6d 6f 72 65 0d 20 73 6f | 70 68 69 73 74 69 63 61 |more. so|phistica|
|00003050| 74 65 64 20 61 70 70 6c | 69 63 61 74 69 6f 6e 73 |ted appl|ications|
|00003060| 2e 20 53 69 6e 63 65 20 | 74 68 65 72 65 20 69 73 |. Since |there is|
|00003070| 20 6e 6f 20 6f 74 68 65 | 72 20 63 6c 65 61 6e 75 | no othe|r cleanu|
|00003080| 70 20 6e 65 65 64 65 64 | 20 61 74 20 74 68 69 73 |p needed| at this|
|00003090| 20 70 6f 69 6e 74 0d 20 | 69 66 20 61 6e 20 65 72 | point. |if an er|
|000030a0| 72 6f 72 20 69 73 20 64 | 65 74 65 63 74 65 64 2c |ror is d|etected,|
|000030b0| 20 74 68 69 73 20 66 6f | 72 6d 20 6f 66 20 65 72 | this fo|rm of er|
|000030c0| 72 6f 72 2d 20 68 61 6e | 64 6c 69 6e 67 20 69 73 |ror- han|dling is|
|000030d0| 20 61 63 63 65 70 74 61 | 62 6c 65 2e 20 49 66 20 | accepta|ble. If |
|000030e0| 6d 6f 72 65 0d 20 73 6f | 70 68 69 73 74 69 63 61 |more. so|phistica|
|000030f0| 74 65 64 20 65 72 72 6f | 72 20 72 65 63 6f 76 65 |ted erro|r recove|
|00003100| 72 79 20 69 73 20 6e 65 | 65 64 65 64 2c 20 61 20 |ry is ne|eded, a |
|00003110| 73 69 67 6e 61 6c 20 6d | 65 63 68 61 6e 69 73 6d |signal m|echanism|
|00003120| 2c 20 73 75 63 68 20 61 | 73 20 69 73 20 70 72 6f |, such a|s is pro|
|00003130| 76 69 64 65 64 0d 20 62 | 79 20 53 69 67 6e 61 6c |vided. b|y Signal|
|00003140| 73 2c 20 63 61 6e 20 62 | 65 20 75 73 65 64 2e 7d |s, can b|e used.}|
|00003150| 0d 0d 56 41 52 0d 09 6d | 65 6e 75 42 61 72 09 09 |..VAR..m|enuBar..|
|00003160| 09 3a 20 48 61 6e 64 6c | 65 3b 0d 09 77 69 6e 64 |.: Handl|e;..wind|
|00003170| 6f 77 09 09 09 3a 20 57 | 69 6e 64 6f 77 50 74 72 |ow...: W|indowPtr|
|00003180| 3b 0d 09 69 67 6e 6f 72 | 65 45 72 72 6f 72 09 09 |;..ignor|eError..|
|00003190| 3a 20 4f 53 45 72 72 3b | 0d 09 74 6f 74 61 6c 2c |: OSErr;|..total,|
|000031a0| 20 63 6f 6e 74 69 67 09 | 3a 20 4c 6f 6e 67 49 6e | contig.|: LongIn|
|000031b0| 74 3b 0d 09 69 67 6e 6f | 72 65 52 65 73 75 6c 74 |t;..igno|reResult|
|000031c0| 09 3a 20 42 4f 4f 4c 45 | 41 4e 3b 0d 09 65 76 65 |.: BOOLE|AN;..eve|
|000031d0| 6e 74 09 09 09 3a 20 45 | 76 65 6e 74 52 65 63 6f |nt...: E|ventReco|
|000031e0| 72 64 3b 0d 09 63 6f 75 | 6e 74 09 09 09 3a 20 49 |rd;..cou|nt...: I|
|000031f0| 4e 54 45 47 45 52 3b 0d | 0d 42 45 47 49 4e 0d 09 |NTEGER;.|.BEGIN..|
|00003200| 67 48 61 73 57 61 69 74 | 4e 65 78 74 45 76 65 6e |gHasWait|NextEven|
|00003210| 74 20 3a 3d 20 54 72 61 | 70 41 76 61 69 6c 61 62 |t := Tra|pAvailab|
|00003220| 6c 65 28 5f 57 61 69 74 | 4e 65 78 74 45 76 65 6e |le(_Wait|NextEven|
|00003230| 74 2c 20 54 6f 6f 6c 54 | 72 61 70 29 3b 0d 09 67 |t, ToolT|rap);..g|
|00003240| 49 6e 42 61 63 6b 67 72 | 6f 75 6e 64 20 3a 3d 20 |InBackgr|ound := |
|00003250| 46 41 4c 53 45 3b 0d 0d | 09 49 6e 69 74 47 72 61 |FALSE;..|.InitGra|
|00003260| 66 28 40 74 68 65 50 6f | 72 74 29 3b 0d 09 49 6e |f(@thePo|rt);..In|
|00003270| 69 74 46 6f 6e 74 73 3b | 0d 09 49 6e 69 74 57 69 |itFonts;|..InitWi|
|00003280| 6e 64 6f 77 73 3b 0d 09 | 49 6e 69 74 4d 65 6e 75 |ndows;..|InitMenu|
|00003290| 73 3b 0d 09 54 45 49 6e | 69 74 3b 0d 09 49 6e 69 |s;..TEIn|it;..Ini|
|000032a0| 74 44 69 61 6c 6f 67 73 | 28 4e 49 4c 29 3b 0d 09 |tDialogs|(NIL);..|
|000032b0| 49 6e 69 74 43 75 72 73 | 6f 72 3b 0d 09 0d 09 7b |InitCurs|or;....{|
|000032c0| 43 61 6c 6c 20 4d 50 50 | 4f 70 65 6e 20 61 6e 64 |Call MPP|Open and|
|000032d0| 20 41 54 50 4c 6f 61 64 | 20 61 74 20 74 68 69 73 | ATPLoad| at this|
|000032e0| 20 70 6f 69 6e 74 20 74 | 6f 20 69 6e 69 74 69 61 | point t|o initia|
|000032f0| 6c 69 7a 65 20 41 70 70 | 6c 65 54 61 6c 6b 2c 0d |lize App|leTalk,.|
|00003300| 09 20 69 66 20 79 6f 75 | 20 61 72 65 20 75 73 69 |. if you| are usi|
|00003310| 6e 67 20 69 74 2e 7d 0d | 09 7b 4e 4f 54 45 20 2d |ng it.}.|.{NOTE -|
|00003320| 2d 20 49 74 20 69 73 20 | 6e 6f 20 6c 6f 6e 67 65 |- It is |no longe|
|00003330| 72 20 6e 65 63 65 73 73 | 61 72 79 2c 20 61 6e 64 |r necess|ary, and|
|00003340| 20 61 63 74 75 61 6c 6c | 79 20 75 6e 68 65 61 6c | actuall|y unheal|
|00003350| 74 68 79 2c 20 74 6f 20 | 63 68 65 63 6b 0d 09 20 |thy, to |check.. |
|00003360| 50 6f 72 74 42 55 73 65 | 20 61 6e 64 20 53 50 43 |PortBUse| and SPC|
|00003370| 6f 6e 66 69 67 20 62 65 | 66 6f 72 65 20 6f 70 65 |onfig be|fore ope|
|00003380| 6e 69 6e 67 20 41 70 70 | 6c 65 54 61 6c 6b 2e 20 |ning App|leTalk. |
|00003390| 54 68 65 20 64 72 69 76 | 65 72 73 20 61 72 65 20 |The driv|ers are |
|000033a0| 63 61 70 61 62 6c 65 0d | 09 20 6f 66 20 63 68 65 |capable.|. of che|
|000033b0| 63 6b 69 6e 67 20 66 6f | 72 20 70 6f 72 74 20 61 |cking fo|r port a|
|000033c0| 76 61 69 6c 61 62 69 6c | 69 74 79 20 74 68 65 6d |vailabil|ity them|
|000033d0| 73 65 6c 76 65 73 2e 7d | 0d 09 0d 09 7b 54 68 69 |selves.}|....{Thi|
|000033e0| 73 20 6e 65 78 74 20 62 | 69 74 20 6f 66 20 63 6f |s next b|it of co|
|000033f0| 64 65 20 69 73 20 6e 65 | 63 65 73 73 61 72 79 20 |de is ne|cessary |
|00003400| 74 6f 20 61 6c 6c 6f 77 | 20 74 68 65 20 64 65 66 |to allow| the def|
|00003410| 61 75 6c 74 20 62 75 74 | 74 6f 6e 20 6f 66 20 6f |ault but|ton of o|
|00003420| 75 72 0d 09 20 61 6c 65 | 72 74 20 62 65 20 6f 75 |ur.. ale|rt be ou|
|00003430| 74 6c 69 6e 65 64 2e 7d | 0d 09 20 0d 09 46 4f 52 |tlined.}|.. ..FOR|
|00003440| 20 63 6f 75 6e 74 20 3a | 3d 20 31 20 54 4f 20 33 | count :|= 1 TO 3|
|00003450| 20 44 4f 0d 09 09 69 67 | 6e 6f 72 65 52 65 73 75 | DO...ig|noreResu|
|00003460| 6c 74 20 3a 3d 20 47 65 | 74 4e 65 78 74 45 76 65 |lt := Ge|tNextEve|
|00003470| 6e 74 28 65 76 65 72 79 | 45 76 65 6e 74 2c 20 65 |nt(every|Event, e|
|00003480| 76 65 6e 74 29 3b 0d 09 | 0d 09 7b 49 67 6e 6f 72 |vent);..|..{Ignor|
|00003490| 65 20 74 68 65 20 65 72 | 72 6f 72 20 72 65 74 75 |e the er|ror retu|
|000034a0| 72 6e 65 64 20 66 72 6f | 6d 20 53 79 73 45 6e 76 |rned fro|m SysEnv|
|000034b0| 69 72 6f 6e 73 3b 20 65 | 76 65 6e 20 69 66 20 61 |irons; e|ven if a|
|000034c0| 6e 20 65 72 72 6f 72 20 | 6f 63 63 75 72 72 65 64 |n error |occurred|
|000034d0| 2c 0d 09 20 74 68 65 20 | 53 79 73 45 6e 76 69 72 |,.. the |SysEnvir|
|000034e0| 6f 6e 73 20 67 6c 75 65 | 20 77 69 6c 6c 20 66 69 |ons glue| will fi|
|000034f0| 6c 6c 20 69 6e 20 74 68 | 65 20 53 79 73 45 6e 76 |ll in th|e SysEnv|
|00003500| 52 65 63 2e 20 59 6f 75 | 20 63 61 6e 20 73 61 76 |Rec. You| can sav|
|00003510| 65 20 61 20 72 65 64 75 | 6e 64 61 6e 74 0d 09 20 |e a redu|ndant.. |
|00003520| 63 61 6c 6c 20 74 6f 20 | 53 79 73 45 6e 76 69 72 |call to |SysEnvir|
|00003530| 6f 6e 73 20 62 79 20 63 | 61 6c 6c 69 6e 67 20 69 |ons by c|alling i|
|00003540| 74 20 61 66 74 65 72 20 | 69 6e 69 74 69 61 6c 69 |t after |initiali|
|00003550| 7a 69 6e 67 20 41 70 70 | 6c 65 54 61 6c 6b 2e 7d |zing App|leTalk.}|
|00003560| 0d 09 20 0d 09 69 67 6e | 6f 72 65 45 72 72 6f 72 |.. ..ign|oreError|
|00003570| 20 3a 3d 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 28 | := SysE|nvirons(|
|00003580| 6b 53 79 73 45 6e 76 69 | 72 6f 6e 73 56 65 72 73 |kSysEnvi|ronsVers|
|00003590| 69 6f 6e 2c 20 67 4d 61 | 63 29 3b 0d 09 0d 09 7b |ion, gMa|c);....{|
|000035a0| 4d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 74 |Make sur|e that t|
|000035b0| 68 65 20 6d 61 63 68 69 | 6e 65 20 68 61 73 20 61 |he machi|ne has a|
|000035c0| 74 20 6c 65 61 73 74 20 | 31 32 38 4b 20 52 4f 4d |t least |128K ROM|
|000035d0| 73 2e 20 49 66 20 69 74 | 20 64 6f 65 73 6e 27 74 |s. If it| doesn't|
|000035e0| 2c 20 65 78 69 74 2e 7d | 0d 09 0d 09 49 46 20 67 |, exit.}|....IF g|
|000035f0| 4d 61 63 2e 6d 61 63 68 | 69 6e 65 54 79 70 65 20 |Mac.mach|ineType |
|00003600| 3c 20 30 20 54 48 45 4e | 20 41 6c 65 72 74 55 73 |< 0 THEN| AlertUs|
|00003610| 65 72 3b 0d 09 0d 09 7b | 31 2e 30 31 20 2d 20 57 |er;....{|1.01 - W|
|00003620| 65 20 75 73 65 64 20 74 | 6f 20 6d 61 6b 65 20 61 |e used t|o make a|
|00003630| 20 63 68 65 63 6b 20 66 | 6f 72 20 6d 65 6d 6f 72 | check f|or memor|
|00003640| 79 20 61 74 20 74 68 69 | 73 20 70 6f 69 6e 74 20 |y at thi|s point |
|00003650| 62 79 20 65 78 61 6d 69 | 6e 69 6e 67 20 41 70 70 |by exami|ning App|
|00003660| 6c 4c 69 6d 69 74 2c 0d | 09 20 41 70 70 6c 69 63 |lLimit,.|. Applic|
|00003670| 5a 6f 6e 65 2c 20 61 6e | 64 20 53 74 61 63 6b 53 |Zone, an|d StackS|
|00003680| 70 61 63 65 20 61 6e 64 | 20 63 6f 6d 70 61 72 69 |pace and| compari|
|00003690| 6e 67 20 74 68 61 74 20 | 74 6f 20 74 68 65 20 6d |ng that |to the m|
|000036a0| 69 6e 69 6d 75 6d 20 73 | 69 7a 65 20 77 65 20 74 |inimum s|ize we t|
|000036b0| 6f 6c 64 0d 09 20 4d 75 | 6c 74 69 46 69 6e 64 65 |old.. Mu|ltiFinde|
|000036c0| 72 20 77 65 20 6e 65 65 | 64 65 64 2e 20 54 68 69 |r we nee|ded. Thi|
|000036d0| 73 20 64 69 64 20 6e 6f | 74 20 77 6f 72 6b 20 77 |s did no|t work w|
|000036e0| 65 6c 6c 20 62 65 63 61 | 75 73 65 20 69 74 20 61 |ell beca|use it a|
|000036f0| 73 73 75 6d 65 64 20 74 | 6f 6f 20 6d 75 63 68 20 |ssumed t|oo much |
|00003700| 61 62 6f 75 74 0d 09 20 | 74 68 65 20 72 65 6c 61 |about.. |the rela|
|00003710| 74 69 6f 6e 73 68 69 70 | 20 62 65 74 77 65 65 6e |tionship| between|
|00003720| 20 77 68 61 74 20 77 65 | 20 61 73 6b 65 64 20 4d | what we| asked M|
|00003730| 75 6c 74 69 46 69 6e 64 | 65 72 20 66 6f 72 20 61 |ultiFind|er for a|
|00003740| 6e 64 20 77 68 61 74 20 | 77 65 20 77 6f 75 6c 64 |nd what |we would|
|00003750| 20 61 63 74 75 61 6c 6c | 79 0d 09 20 67 65 74 20 | actuall|y.. get |
|00003760| 62 61 63 6b 2c 20 61 73 | 20 77 65 6c 6c 20 61 73 |back, as| well as|
|00003770| 20 68 6f 77 20 74 6f 20 | 6d 65 61 73 75 72 65 20 | how to |measure |
|00003780| 69 74 2e 20 49 6e 73 74 | 65 61 64 2c 20 77 65 20 |it. Inst|ead, we |
|00003790| 77 69 6c 6c 20 75 73 65 | 20 61 6e 20 61 6c 74 65 |will use| an alte|
|000037a0| 72 6e 61 74 65 0d 09 20 | 6d 65 74 68 6f 64 20 63 |rnate.. |method c|
|000037b0| 6f 6d 70 72 69 73 65 64 | 20 6f 66 20 74 77 6f 20 |omprised| of two |
|000037c0| 73 74 65 70 73 2e 7d 0d | 09 20 0d 09 7b 49 74 20 |steps.}.|. ..{It |
|000037d0| 69 73 20 62 65 74 74 65 | 72 20 74 6f 20 66 69 72 |is bette|r to fir|
|000037e0| 73 74 20 63 68 65 63 6b | 20 74 68 65 20 73 69 7a |st check| the siz|
|000037f0| 65 20 6f 66 20 74 68 65 | 20 61 70 70 6c 69 63 61 |e of the| applica|
|00003800| 74 69 6f 6e 20 68 65 61 | 70 20 61 67 61 69 6e 73 |tion hea|p agains|
|00003810| 74 20 61 20 76 61 6c 75 | 65 0d 09 20 74 68 61 74 |t a valu|e.. that|
|00003820| 20 79 6f 75 20 68 61 76 | 65 20 64 65 74 65 72 6d | you hav|e determ|
|00003830| 69 6e 65 64 20 69 73 20 | 74 68 65 20 73 6d 61 6c |ined is |the smal|
|00003840| 6c 65 73 74 20 68 65 61 | 70 20 74 68 65 20 61 70 |lest hea|p the ap|
|00003850| 70 6c 69 63 61 74 69 6f | 6e 20 63 61 6e 20 72 65 |plicatio|n can re|
|00003860| 61 73 6f 6e 61 62 6c 79 | 0d 09 20 77 6f 72 6b 20 |asonably|.. work |
|00003870| 69 6e 2e 20 54 68 69 73 | 20 6e 75 6d 62 65 72 20 |in. This| number |
|00003880| 73 68 6f 75 6c 64 20 62 | 65 20 64 65 72 69 76 65 |should b|e derive|
|00003890| 64 20 62 79 20 65 78 61 | 6d 69 6e 69 6e 67 20 74 |d by exa|mining t|
|000038a0| 68 65 20 73 69 7a 65 20 | 6f 66 20 74 68 65 20 68 |he size |of the h|
|000038b0| 65 61 70 20 74 68 61 74 | 0d 09 20 69 73 20 61 63 |eap that|.. is ac|
|000038c0| 74 75 61 6c 6c 79 20 70 | 72 6f 76 69 64 65 64 20 |tually p|rovided |
|000038d0| 62 79 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 77 |by Multi|Finder w|
|000038e0| 68 65 6e 20 74 68 65 20 | 6d 69 6e 69 6d 75 6d 20 |hen the |minimum |
|000038f0| 73 69 7a 65 20 72 65 71 | 75 65 73 74 65 64 20 69 |size req|uested i|
|00003900| 73 20 75 73 65 64 2e 0d | 09 20 54 68 65 20 64 65 |s used..|. The de|
|00003910| 72 69 76 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |rivation| of the |
|00003920| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 72 65 71 |minimum |size req|
|00003930| 75 65 73 74 65 64 20 66 | 72 6f 6d 20 4d 75 6c 74 |uested f|rom Mult|
|00003940| 69 46 69 6e 64 65 72 20 | 69 73 20 64 65 73 63 72 |iFinder |is descr|
|00003950| 69 62 65 64 0d 09 20 69 | 6e 20 53 61 6d 70 6c 65 |ibed.. i|n Sample|
|00003960| 2e 68 2e 20 54 68 65 20 | 63 68 65 63 6b 20 73 68 |.h. The |check sh|
|00003970| 6f 75 6c 64 20 62 65 20 | 6d 61 64 65 20 62 65 63 |ould be |made bec|
|00003980| 61 75 73 65 20 74 68 65 | 20 70 72 65 66 65 72 72 |ause the| preferr|
|00003990| 65 64 20 73 69 7a 65 20 | 63 61 6e 20 65 6e 64 20 |ed size |can end |
|000039a0| 75 70 0d 09 20 62 65 69 | 6e 67 20 73 65 74 20 73 |up.. bei|ng set s|
|000039b0| 6d 61 6c 6c 65 72 20 74 | 68 61 6e 20 74 68 65 20 |maller t|han the |
|000039c0| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 62 79 20 |minimum |size by |
|000039d0| 74 68 65 20 75 73 65 72 | 2e 20 54 68 69 73 20 65 |the user|. This e|
|000039e0| 78 74 72 61 20 63 68 65 | 63 6b 20 61 63 74 73 20 |xtra che|ck acts |
|000039f0| 74 6f 0d 09 20 69 6e 73 | 75 72 65 20 74 68 61 74 |to.. ins|ure that|
|00003a00| 20 79 6f 75 72 20 61 70 | 70 6c 69 63 61 74 69 6f | your ap|plicatio|
|00003a10| 6e 20 69 73 20 73 74 61 | 72 74 69 6e 67 20 66 72 |n is sta|rting fr|
|00003a20| 6f 6d 20 61 20 73 6f 6c | 69 64 20 6d 65 6d 6f 72 |om a sol|id memor|
|00003a30| 79 20 66 6f 75 6e 64 61 | 74 69 6f 6e 2e 7d 0d 09 |y founda|tion.}..|
|00003a40| 20 0d 09 49 46 20 4f 52 | 44 28 47 65 74 41 70 70 | ..IF OR|D(GetApp|
|00003a50| 6c 4c 69 6d 69 74 29 20 | 2d 20 4f 52 44 28 41 70 |lLimit) |- ORD(Ap|
|00003a60| 70 6c 69 63 5a 6f 6e 65 | 29 20 3c 20 6b 4d 69 6e |plicZone|) < kMin|
|00003a70| 48 65 61 70 20 54 48 45 | 4e 20 41 6c 65 72 74 55 |Heap THE|N AlertU|
|00003a80| 73 65 72 3b 0d 09 0d 09 | 7b 4e 65 78 74 2c 20 6d |ser;....|{Next, m|
|00003a90| 61 6b 65 20 73 75 72 65 | 20 74 68 61 74 20 65 6e |ake sure| that en|
|00003aa0| 6f 75 67 68 20 6d 65 6d | 6f 72 79 20 69 73 20 66 |ough mem|ory is f|
|00003ab0| 72 65 65 20 66 6f 72 20 | 79 6f 75 72 20 61 70 70 |ree for |your app|
|00003ac0| 6c 69 63 61 74 69 6f 6e | 20 74 6f 20 72 75 6e 2e |lication| to run.|
|00003ad0| 20 49 74 0d 09 20 69 73 | 20 70 6f 73 73 69 62 6c | It.. is| possibl|
|00003ae0| 65 20 66 6f 72 20 61 20 | 73 69 74 75 61 74 69 6f |e for a |situatio|
|00003af0| 6e 20 74 6f 20 61 72 69 | 73 65 20 77 68 65 72 65 |n to ari|se where|
|00003b00| 20 74 68 65 20 68 65 61 | 70 20 6d 61 79 20 68 61 | the hea|p may ha|
|00003b10| 76 65 20 62 65 65 6e 20 | 6f 66 20 72 65 71 75 69 |ve been |of requi|
|00003b20| 72 65 64 0d 09 20 73 69 | 7a 65 2c 20 62 75 74 20 |red.. si|ze, but |
|00003b30| 61 20 6c 61 72 67 65 20 | 73 63 72 61 70 20 77 61 |a large |scrap wa|
|00003b40| 73 20 6c 6f 61 64 65 64 | 20 77 68 69 63 68 20 6c |s loaded| which l|
|00003b50| 65 66 74 20 74 6f 6f 20 | 6c 69 74 74 6c 65 20 6d |eft too |little m|
|00003b60| 65 6d 6f 72 79 2e 20 54 | 6f 20 63 68 65 63 6b 20 |emory. T|o check |
|00003b70| 66 6f 72 0d 09 20 74 68 | 69 73 2c 20 63 61 6c 6c |for.. th|is, call|
|00003b80| 20 50 75 72 67 65 53 70 | 61 63 65 20 61 6e 64 20 | PurgeSp|ace and |
|00003b90| 63 6f 6d 70 61 72 65 20 | 74 68 65 20 72 65 73 75 |compare |the resu|
|00003ba0| 6c 74 20 77 69 74 68 20 | 61 20 76 61 6c 75 65 20 |lt with |a value |
|00003bb0| 74 68 61 74 20 79 6f 75 | 20 68 61 76 65 20 64 65 |that you| have de|
|00003bc0| 74 65 72 6d 69 6e 65 64 | 0d 09 20 69 73 20 74 68 |termined|.. is th|
|00003bd0| 65 20 6d 69 6e 69 6d 75 | 6d 20 61 6d 6f 75 6e 74 |e minimu|m amount|
|00003be0| 20 6f 66 20 66 72 65 65 | 20 6d 65 6d 6f 72 79 20 | of free| memory |
|00003bf0| 79 6f 75 72 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |your app|lication|
|00003c00| 20 6e 65 65 64 73 20 61 | 74 20 69 6e 69 74 69 61 | needs a|t initia|
|00003c10| 6c 69 7a 61 74 69 6f 6e | 2e 0d 09 20 54 68 69 73 |lization|... This|
|00003c20| 20 6e 75 6d 62 65 72 20 | 63 61 6e 20 62 65 20 64 | number |can be d|
|00003c30| 65 72 69 76 65 64 20 73 | 65 76 65 72 61 6c 20 64 |erived s|everal d|
|00003c40| 69 66 66 65 72 65 6e 74 | 20 77 61 79 73 2e 20 4f |ifferent| ways. O|
|00003c50| 6e 65 20 77 61 79 20 74 | 68 61 74 20 69 73 20 66 |ne way t|hat is f|
|00003c60| 61 69 72 6c 79 0d 09 20 | 73 74 72 61 69 67 68 74 |airly.. |straight|
|00003c70| 66 6f 72 77 61 72 64 20 | 69 73 20 74 6f 20 72 75 |forward |is to ru|
|00003c80| 6e 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |n the ap|plicatio|
|00003c90| 6e 20 69 6e 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |n in the| minimum|
|00003ca0| 20 73 69 7a 65 20 63 6f | 6e 66 69 67 75 72 61 74 | size co|nfigurat|
|00003cb0| 69 6f 6e 0d 09 20 61 73 | 20 64 65 73 63 72 69 62 |ion.. as| describ|
|00003cc0| 65 64 20 70 72 65 76 69 | 6f 75 73 6c 79 2e 20 43 |ed previ|ously. C|
|00003cd0| 61 6c 6c 20 50 75 72 67 | 65 53 70 61 63 65 20 61 |all Purg|eSpace a|
|00003ce0| 74 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e |t initia|lization|
|00003cf0| 20 61 6e 64 20 65 78 61 | 6d 69 6e 65 20 74 68 65 | and exa|mine the|
|00003d00| 20 76 61 6c 75 65 0d 09 | 20 72 65 74 75 72 6e 65 | value..| returne|
|00003d10| 64 2e 20 48 6f 77 65 76 | 65 72 2c 20 79 6f 75 20 |d. Howev|er, you |
|00003d20| 73 68 6f 75 6c 64 20 6d | 61 6b 65 20 73 75 72 65 |should m|ake sure|
|00003d30| 20 74 68 61 74 20 74 68 | 69 73 20 72 65 73 75 6c | that th|is resul|
|00003d40| 74 20 69 73 20 6e 6f 74 | 20 62 65 69 6e 67 20 6d |t is not| being m|
|00003d50| 6f 64 69 66 69 65 64 0d | 09 20 62 79 20 74 68 65 |odified.|. by the|
|00003d60| 20 73 63 72 61 70 27 73 | 20 70 72 65 73 65 6e 63 | scrap's| presenc|
|00003d70| 65 2e 20 59 6f 75 20 63 | 61 6e 20 64 6f 20 74 68 |e. You c|an do th|
|00003d80| 61 74 20 62 79 20 63 61 | 6c 6c 69 6e 67 20 5a 65 |at by ca|lling Ze|
|00003d90| 72 6f 53 63 72 61 70 20 | 62 65 66 6f 72 65 20 63 |roScrap |before c|
|00003da0| 61 6c 6c 69 6e 67 0d 09 | 20 50 75 72 67 65 53 70 |alling..| PurgeSp|
|00003db0| 61 63 65 2e 20 4d 61 6b | 65 20 73 75 72 65 20 74 |ace. Mak|e sure t|
|00003dc0| 6f 20 72 65 6d 6f 76 65 | 20 74 68 61 74 20 63 61 |o remove| that ca|
|00003dd0| 6c 6c 20 62 65 66 6f 72 | 65 20 73 68 69 70 70 69 |ll befor|e shippi|
|00003de0| 6e 67 2c 20 74 68 6f 75 | 67 68 2e 7d 0d 09 20 0d |ng, thou|gh.}.. .|
|00003df0| 09 50 75 72 67 65 53 70 | 61 63 65 28 74 6f 74 61 |.PurgeSp|ace(tota|
|00003e00| 6c 2c 20 63 6f 6e 74 69 | 67 29 3b 0d 09 49 46 20 |l, conti|g);..IF |
|00003e10| 74 6f 74 61 6c 20 3c 20 | 6b 4d 69 6e 53 70 61 63 |total < |kMinSpac|
|00003e20| 65 20 54 48 45 4e 20 41 | 6c 65 72 74 55 73 65 72 |e THEN A|lertUser|
|00003e30| 3b 0d 0d 09 7b 54 68 65 | 20 65 78 74 72 61 20 62 |;...{The| extra b|
|00003e40| 65 6e 65 66 69 74 20 74 | 6f 20 77 61 69 74 6e 67 |enefit t|o waitng|
|00003e50| 20 75 6e 74 69 6c 20 61 | 66 74 65 72 20 74 68 65 | until a|fter the|
|00003e60| 20 54 6f 6f 6c 62 6f 78 | 20 4d 61 6e 61 67 65 72 | Toolbox| Manager|
|00003e70| 73 20 68 61 76 65 20 62 | 65 65 6e 20 69 6e 69 74 |s have b|een init|
|00003e80| 69 61 6c 69 7a 65 64 0d | 09 20 62 65 66 6f 72 65 |ialized.|. before|
|00003e90| 20 63 68 65 63 6b 69 6e | 67 20 6d 65 6d 6f 72 79 | checkin|g memory|
|00003ea0| 20 69 73 20 74 68 61 74 | 20 77 65 20 63 61 6e 20 | is that| we can |
|00003eb0| 6e 6f 77 20 67 69 76 65 | 20 74 68 65 20 75 73 65 |now give| the use|
|00003ec0| 72 20 61 6e 20 61 6c 65 | 72 74 20 74 6f 20 74 65 |r an ale|rt to te|
|00003ed0| 6c 6c 20 68 69 6d 20 77 | 68 61 74 0d 09 20 68 61 |ll him w|hat.. ha|
|00003ee0| 70 70 65 6e 65 64 2e 20 | 41 6c 74 68 6f 75 67 68 |ppened. |Although|
|00003ef0| 20 69 74 20 69 73 20 70 | 6f 73 73 69 62 6c 65 20 | it is p|ossible |
|00003f00| 74 68 61 74 20 74 68 65 | 20 6d 65 6d 6f 72 79 20 |that the| memory |
|00003f10| 73 69 74 75 61 74 69 6f | 6e 20 63 6f 75 6c 64 20 |situatio|n could |
|00003f20| 62 65 20 77 6f 72 73 65 | 6e 65 64 20 62 79 0d 09 |be worse|ned by..|
|00003f30| 20 64 69 73 70 6c 61 79 | 69 6e 67 20 61 6e 20 61 | display|ing an a|
|00003f40| 6c 65 72 74 2c 20 4d 75 | 6c 74 69 46 69 6e 64 65 |lert, Mu|ltiFinde|
|00003f50| 72 20 77 6f 75 6c 64 20 | 67 72 61 63 65 66 75 6c |r would |graceful|
|00003f60| 6c 79 20 65 78 69 74 20 | 74 68 65 20 61 70 70 6c |ly exit |the appl|
|00003f70| 69 63 61 74 69 6f 6e 20 | 77 69 74 68 0d 09 20 61 |ication |with.. a|
|00003f80| 6e 20 69 6e 66 6f 72 6d | 61 74 69 76 65 20 61 6c |n inform|ative al|
|00003f90| 65 72 74 20 69 66 20 6d | 65 6d 6f 72 79 20 62 65 |ert if m|emory be|
|00003fa0| 63 61 6d 65 20 63 72 69 | 74 69 63 61 6c 2e 20 48 |came cri|tical. H|
|00003fb0| 65 72 65 20 77 65 20 61 | 72 65 20 61 63 74 69 6e |ere we a|re actin|
|00003fc0| 67 20 6d 6f 72 65 0d 09 | 20 69 6e 20 61 20 70 72 |g more..| in a pr|
|00003fd0| 65 76 65 6e 74 61 74 69 | 76 65 20 6d 61 6e 6e 65 |eventati|ve manne|
|00003fe0| 72 20 74 6f 20 61 76 6f | 69 64 20 66 75 74 75 72 |r to avo|id futur|
|00003ff0| 65 20 64 69 73 61 73 74 | 65 72 20 66 72 6f 6d 20 |e disast|er from |
|00004000| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 70 72 6f 62 6c |low-memo|ry probl|
|00004010| 65 6d 73 2e 7d 0d 09 20 | 0d 09 7b 57 65 20 77 69 |ems.}.. |..{We wi|
|00004020| 6c 6c 20 61 6c 6c 6f 63 | 61 74 65 20 6f 75 72 20 |ll alloc|ate our |
|00004030| 6f 77 6e 20 77 69 6e 64 | 6f 77 20 73 74 6f 72 61 |own wind|ow stora|
|00004040| 67 65 20 69 6e 73 74 65 | 61 64 20 6f 66 20 6c 65 |ge inste|ad of le|
|00004050| 74 74 69 6e 67 20 74 68 | 65 20 57 69 6e 64 6f 77 |tting th|e Window|
|00004060| 0d 09 20 4d 61 6e 61 67 | 65 72 20 66 6f 72 20 74 |.. Manag|er for t|
|00004070| 77 6f 20 72 65 61 73 6f | 6e 73 2e 20 4f 6e 65 2c |wo reaso|ns. One,|
|00004080| 20 47 65 74 4e 65 77 57 | 69 6e 64 6f 77 20 6c 6f | GetNewW|indow lo|
|00004090| 63 6b 73 20 74 68 65 20 | 27 57 49 4e 44 27 20 72 |cks the |'WIND' r|
|000040a0| 65 73 6f 75 72 63 65 0d | 09 20 68 61 6e 64 6c 65 |esource.|. handle|
|000040b0| 20 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 20 | before |calling |
|000040c0| 4e 65 77 57 69 6e 64 6f | 77 20 61 6e 64 20 74 68 |NewWindo|w and th|
|000040d0| 69 73 20 63 61 6e 20 6c | 65 61 64 20 74 6f 20 68 |is can l|ead to h|
|000040e0| 65 61 70 20 66 72 61 67 | 6d 65 6e 74 61 74 69 6f |eap frag|mentatio|
|000040f0| 6e 2e 0d 09 20 54 77 6f | 2c 20 69 74 20 74 61 6b |n... Two|, it tak|
|00004100| 65 73 20 6a 75 73 74 20 | 61 73 20 6d 75 63 68 20 |es just |as much |
|00004110| 74 69 6d 65 20 66 6f 72 | 20 4e 65 77 57 69 6e 64 |time for| NewWind|
|00004120| 6f 77 20 74 6f 20 67 65 | 74 20 74 68 65 20 6d 65 |ow to ge|t the me|
|00004130| 6d 6f 72 79 20 61 73 20 | 69 74 0d 09 20 64 6f 65 |mory as |it.. doe|
|00004140| 73 20 66 6f 72 20 75 73 | 20 74 6f 20 67 65 74 20 |s for us| to get |
|00004150| 69 74 2e 7d 0d 0d 09 77 | 69 6e 64 6f 77 20 3a 3d |it.}...w|indow :=|
|00004160| 20 57 69 6e 64 6f 77 50 | 74 72 28 4e 65 77 50 74 | WindowP|tr(NewPt|
|00004170| 72 28 53 49 5a 45 4f 46 | 28 57 69 6e 64 6f 77 52 |r(SIZEOF|(WindowR|
|00004180| 65 63 6f 72 64 29 29 29 | 3b 0d 09 49 46 20 77 69 |ecord)))|;..IF wi|
|00004190| 6e 64 6f 77 20 3d 20 4e | 49 4c 20 54 48 45 4e 20 |ndow = N|IL THEN |
|000041a0| 41 6c 65 72 74 55 73 65 | 72 3b 0d 09 77 69 6e 64 |AlertUse|r;..wind|
|000041b0| 6f 77 20 3a 3d 20 47 65 | 74 4e 65 77 57 69 6e 64 |ow := Ge|tNewWind|
|000041c0| 6f 77 28 72 57 69 6e 64 | 6f 77 2c 20 50 74 72 28 |ow(rWind|ow, Ptr(|
|000041d0| 77 69 6e 64 6f 77 29 2c | 20 57 69 6e 64 6f 77 50 |window),| WindowP|
|000041e0| 74 72 28 2d 31 29 29 3b | 0d 0d 09 6d 65 6e 75 42 |tr(-1));|...menuB|
|000041f0| 61 72 20 3a 3d 20 47 65 | 74 4e 65 77 4d 42 61 72 |ar := Ge|tNewMBar|
|00004200| 28 72 4d 65 6e 75 42 61 | 72 29 3b 09 09 7b 72 65 |(rMenuBa|r);..{re|
|00004210| 61 64 20 6d 65 6e 75 73 | 20 69 6e 74 6f 20 6d 65 |ad menus| into me|
|00004220| 6e 75 20 62 61 72 7d 0d | 09 49 46 20 6d 65 6e 75 |nu bar}.|.IF menu|
|00004230| 42 61 72 20 3d 20 4e 49 | 4c 20 54 48 45 4e 20 41 |Bar = NI|L THEN A|
|00004240| 6c 65 72 74 55 73 65 72 | 3b 0d 09 53 65 74 4d 65 |lertUser|;..SetMe|
|00004250| 6e 75 42 61 72 28 6d 65 | 6e 75 42 61 72 29 3b 09 |nuBar(me|nuBar);.|
|00004260| 09 09 09 09 7b 69 6e 73 | 74 61 6c 6c 20 6d 65 6e |....{ins|tall men|
|00004270| 75 73 7d 0d 09 44 69 73 | 70 6f 73 48 61 6e 64 6c |us}..Dis|posHandl|
|00004280| 65 28 6d 65 6e 75 42 61 | 72 29 3b 0d 09 41 64 64 |e(menuBa|r);..Add|
|00004290| 52 65 73 4d 65 6e 75 28 | 47 65 74 4d 48 61 6e 64 |ResMenu(|GetMHand|
|000042a0| 6c 65 28 6d 41 70 70 6c | 65 29 2c 20 27 44 52 56 |le(mAppl|e), 'DRV|
|000042b0| 52 27 29 3b 09 7b 61 64 | 64 20 44 41 20 6e 61 6d |R');.{ad|d DA nam|
|000042c0| 65 73 20 74 6f 20 41 70 | 70 6c 65 20 6d 65 6e 75 |es to Ap|ple menu|
|000042d0| 7d 0d 09 44 72 61 77 4d | 65 6e 75 42 61 72 3b 0d |}..DrawM|enuBar;.|
|000042e0| 0d 09 67 53 74 6f 70 70 | 65 64 20 3a 3d 20 54 52 |..gStopp|ed := TR|
|000042f0| 55 45 3b 0d 09 49 46 20 | 4e 4f 54 20 47 6f 47 65 |UE;..IF |NOT GoGe|
|00004300| 74 52 65 63 74 28 72 53 | 74 6f 70 52 65 63 74 2c |tRect(rS|topRect,|
|00004310| 20 67 53 74 6f 70 52 65 | 63 74 29 20 54 48 45 4e | gStopRe|ct) THEN|
|00004320| 0d 09 09 41 6c 65 72 74 | 55 73 65 72 3b 09 09 09 |...Alert|User;...|
|00004330| 09 09 09 09 7b 74 68 65 | 20 73 74 6f 70 20 6c 69 |....{the| stop li|
|00004340| 67 68 74 20 72 65 63 74 | 61 6e 67 6c 65 7d 0d 09 |ght rect|angle}..|
|00004350| 49 46 20 4e 4f 54 20 47 | 6f 47 65 74 52 65 63 74 |IF NOT G|oGetRect|
|00004360| 28 72 47 6f 52 65 63 74 | 2c 20 67 47 6f 52 65 63 |(rGoRect|, gGoRec|
|00004370| 74 29 20 54 48 45 4e 0d | 09 09 41 6c 65 72 74 55 |t) THEN.|..AlertU|
|00004380| 73 65 72 3b 09 09 09 09 | 09 09 09 7b 74 68 65 20 |ser;....|...{the |
|00004390| 67 6f 20 6c 69 67 68 74 | 20 72 65 63 74 61 6e 67 |go light| rectang|
|000043a0| 6c 65 7d 0d 45 4e 44 3b | 20 7b 49 6e 69 74 69 61 |le}.END;| {Initia|
|000043b0| 6c 69 7a 65 7d 0d 0d 0d | 28 2a 2a 2a 2a 2a 2a 2a |lize}...|(*******|
|000043c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000043d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000043e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000043f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004400| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|00004410| 31 2e 30 31 20 2d 20 50 | 52 4f 43 45 44 55 52 45 |1.01 - P|ROCEDURE|
|00004420| 20 44 6f 43 6c 6f 73 65 | 42 65 68 69 6e 64 28 77 | DoClose|Behind(w|
|00004430| 69 6e 64 6f 77 3a 20 57 | 69 6e 64 6f 77 50 74 72 |indow: W|indowPtr|
|00004440| 29 3b 20 77 61 73 20 72 | 65 6d 6f 76 65 64 2e 0d |); was r|emoved..|
|00004450| 0d 7b 31 2e 30 31 20 2d | 20 44 6f 43 6c 6f 73 65 |.{1.01 -| DoClose|
|00004460| 42 65 68 69 6e 64 20 77 | 61 73 20 61 20 67 6f 6f |Behind w|as a goo|
|00004470| 64 20 69 64 65 61 20 66 | 6f 72 20 63 6c 6f 73 69 |d idea f|or closi|
|00004480| 6e 67 20 77 69 6e 64 6f | 77 73 20 77 68 65 6e 20 |ng windo|ws when |
|00004490| 71 75 69 74 74 69 6e 67 | 0d 20 61 6e 64 20 6e 6f |quitting|. and no|
|000044a0| 74 20 68 61 76 69 6e 67 | 20 74 6f 20 77 6f 72 72 |t having| to worr|
|000044b0| 79 20 61 62 6f 75 74 20 | 75 70 64 61 74 69 6e 67 |y about |updating|
|000044c0| 20 74 68 65 20 77 69 6e | 64 6f 77 73 2c 20 62 75 | the win|dows, bu|
|000044d0| 74 20 69 74 20 73 75 66 | 66 65 72 65 64 0d 20 66 |t it suf|fered. f|
|000044e0| 72 6f 6d 20 61 20 66 61 | 74 61 6c 20 66 6c 61 77 |rom a fa|tal flaw|
|000044f0| 2e 20 49 66 20 61 20 64 | 65 73 6b 20 61 63 63 65 |. If a d|esk acce|
|00004500| 73 73 6f 72 79 20 6f 77 | 6e 65 64 20 74 77 6f 20 |ssory ow|ned two |
|00004510| 77 69 6e 64 6f 77 73 2c | 20 69 74 20 77 6f 75 6c |windows,| it woul|
|00004520| 64 0d 20 63 6c 6f 73 65 | 20 62 6f 74 68 20 74 68 |d. close| both th|
|00004530| 6f 73 65 20 77 69 6e 64 | 6f 77 73 20 77 68 65 6e |ose wind|ows when|
|00004540| 20 43 6c 6f 73 65 44 65 | 73 6b 41 63 63 20 77 61 | CloseDe|skAcc wa|
|00004550| 73 20 63 61 6c 6c 65 64 | 2e 20 57 68 65 6e 20 44 |s called|. When D|
|00004560| 6f 43 6c 6f 73 65 42 65 | 68 69 6e 64 0d 20 67 6f |oCloseBe|hind. go|
|00004570| 74 20 61 72 6f 75 6e 64 | 20 74 6f 20 63 61 6c 6c |t around| to call|
|00004580| 69 6e 67 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f |ing DoCl|oseWindo|
|00004590| 77 20 66 6f 72 20 74 68 | 61 74 20 6f 74 68 65 72 |w for th|at other|
|000045a0| 20 77 69 6e 64 6f 77 20 | 74 68 61 74 20 77 61 73 | window |that was|
|000045b0| 20 61 6c 72 65 61 64 79 | 0d 20 63 6c 6f 73 65 64 | already|. closed|
|000045c0| 2c 20 74 68 69 6e 67 73 | 20 77 6f 75 6c 64 20 67 |, things| would g|
|000045d0| 6f 20 76 65 72 79 20 70 | 6f 6f 72 6c 79 2e 20 41 |o very p|oorly. A|
|000045e0| 6e 6f 74 68 65 72 20 6f | 70 74 69 6f 6e 20 77 6f |nother o|ption wo|
|000045f0| 75 6c 64 20 62 65 20 74 | 6f 20 68 61 76 65 20 61 |uld be t|o have a|
|00004600| 0d 20 70 72 6f 63 65 64 | 75 72 65 2c 20 47 65 74 |. proced|ure, Get|
|00004610| 52 65 61 72 57 69 6e 64 | 6f 77 2c 20 74 68 61 74 |RearWind|ow, that|
|00004620| 20 77 6f 75 6c 64 20 67 | 6f 20 74 68 72 6f 75 67 | would g|o throug|
|00004630| 68 20 74 68 65 20 77 69 | 6e 64 6f 77 20 6c 69 73 |h the wi|ndow lis|
|00004640| 74 20 61 6e 64 20 72 65 | 74 75 72 6e 0d 20 74 68 |t and re|turn. th|
|00004650| 65 20 6c 61 73 74 20 77 | 69 6e 64 6f 77 2e 20 49 |e last w|indow. I|
|00004660| 6e 73 74 65 61 64 2c 20 | 77 65 20 64 65 63 69 64 |nstead, |we decid|
|00004670| 65 64 20 74 6f 20 70 72 | 65 73 65 6e 74 20 74 68 |ed to pr|esent th|
|00004680| 65 20 73 74 61 6e 64 61 | 72 64 20 61 70 70 72 6f |e standa|rd appro|
|00004690| 61 63 68 0d 20 6f 66 20 | 67 65 74 74 69 6e 67 20 |ach. of |getting |
|000046a0| 61 6e 64 20 63 6c 6f 73 | 69 6e 67 20 46 72 6f 6e |and clos|ing Fron|
|000046b0| 74 57 69 6e 64 6f 77 20 | 75 6e 74 69 6c 20 46 72 |tWindow |until Fr|
|000046c0| 6f 6e 74 57 69 6e 64 6f | 77 20 72 65 74 75 72 6e |ontWindo|w return|
|000046d0| 73 20 4e 49 4c 2e 20 54 | 68 69 73 0d 20 68 61 73 |s NIL. T|his. has|
|000046e0| 20 61 20 70 6f 74 65 6e | 74 69 61 6c 20 62 65 6e | a poten|tial ben|
|000046f0| 65 66 69 74 20 69 6e 20 | 74 68 61 74 20 74 68 65 |efit in |that the|
|00004700| 20 77 69 6e 64 6f 77 20 | 77 68 6f 73 65 20 64 6f | window |whose do|
|00004710| 63 75 6d 65 6e 74 20 6e | 65 65 64 73 20 74 6f 20 |cument n|eeds to |
|00004720| 62 65 20 73 61 76 65 64 | 0d 20 6d 61 79 20 62 65 |be saved|. may be|
|00004730| 20 76 69 73 69 62 6c 65 | 20 73 69 6e 63 65 20 69 | visible| since i|
|00004740| 74 20 69 73 20 74 68 65 | 20 66 72 6f 6e 74 20 77 |t is the| front w|
|00004750| 69 6e 64 6f 77 2c 20 74 | 68 65 72 65 66 6f 72 65 |indow, t|herefore|
|00004760| 20 64 65 63 72 65 61 73 | 69 6e 67 20 74 68 65 0d | decreas|ing the.|
|00004770| 20 63 68 61 6e 63 65 20 | 6f 66 20 75 73 65 72 20 | chance |of user |
|00004780| 63 6f 6e 66 75 73 69 6f | 6e 2e 20 46 6f 72 20 61 |confusio|n. For a|
|00004790| 65 73 74 68 65 74 69 63 | 20 72 65 61 73 6f 6e 73 |esthetic| reasons|
|000047a0| 2c 20 74 68 65 20 77 69 | 6e 64 6f 77 73 20 69 6e |, the wi|ndows in|
|000047b0| 20 74 68 65 0d 20 61 70 | 70 6c 69 63 61 74 69 6f | the. ap|plicatio|
|000047c0| 6e 20 73 68 6f 75 6c 64 | 20 62 65 20 63 68 65 63 |n should| be chec|
|000047d0| 6b 65 64 20 66 6f 72 20 | 75 70 64 61 74 65 73 20 |ked for |updates |
|000047e0| 70 65 72 69 6f 64 69 63 | 61 6c 6c 79 20 61 6e 64 |periodic|ally and|
|000047f0| 20 68 61 76 65 20 74 68 | 65 0d 20 75 70 64 61 74 | have th|e. updat|
|00004800| 65 73 20 73 65 72 76 69 | 63 65 64 2e 7d 0d 2a 2a |es servi|ced.}.**|
|00004810| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004820| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004830| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004840| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004850| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004860| 2a 2a 2a 2a 29 0d 0d 0d | 7b 24 53 20 4d 61 69 6e |****)...|{$S Main|
|00004870| 7d 0d 50 52 4f 43 45 44 | 55 52 45 20 54 65 72 6d |}.PROCED|URE Term|
|00004880| 69 6e 61 74 65 3b 0d 0d | 7b 43 6c 65 61 6e 20 75 |inate;..|{Clean u|
|00004890| 70 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |p the ap|plicatio|
|000048a0| 6e 20 61 6e 64 20 65 78 | 69 74 73 2e 20 57 65 20 |n and ex|its. We |
|000048b0| 63 6c 6f 73 65 20 61 6c | 6c 20 6f 66 20 74 68 65 |close al|l of the|
|000048c0| 20 77 69 6e 64 6f 77 73 | 20 73 6f 20 74 68 61 74 | windows| so that|
|000048d0| 0d 20 74 68 65 79 20 63 | 61 6e 20 75 70 64 61 74 |. they c|an updat|
|000048e0| 65 20 74 68 65 69 72 20 | 64 6f 63 75 6d 65 6e 74 |e their |document|
|000048f0| 73 2c 20 69 66 20 61 6e | 79 2e 7d 0d 20 0d 7b 31 |s, if an|y.}. .{1|
|00004900| 2e 30 31 20 2d 20 49 66 | 20 77 65 20 66 69 6e 64 |.01 - If| we find|
|00004910| 20 6f 75 74 20 74 68 61 | 74 20 61 20 63 61 6e 63 | out tha|t a canc|
|00004920| 65 6c 20 68 61 73 20 6f | 63 63 75 72 72 65 64 2c |el has o|ccurred,|
|00004930| 20 77 65 20 77 6f 6e 27 | 74 20 65 78 69 74 20 74 | we won'|t exit t|
|00004940| 6f 20 74 68 65 0d 20 73 | 68 65 6c 6c 2c 20 62 75 |o the. s|hell, bu|
|00004950| 74 20 77 69 6c 6c 20 72 | 65 74 75 72 6e 20 69 6e |t will r|eturn in|
|00004960| 73 74 65 61 64 2e 7d 0d | 20 0d 56 41 52 0d 09 61 |stead.}.| .VAR..a|
|00004970| 57 69 6e 64 6f 77 09 3a | 20 57 69 6e 64 6f 77 50 |Window.:| WindowP|
|00004980| 74 72 3b 0d 09 63 6c 6f | 73 65 64 09 3a 20 42 4f |tr;..clo|sed.: BO|
|00004990| 4f 4c 45 41 4e 3b 0d 0d | 42 45 47 49 4e 0d 09 63 |OLEAN;..|BEGIN..c|
|000049a0| 6c 6f 73 65 64 20 3a 3d | 20 54 52 55 45 3b 0d 09 |losed :=| TRUE;..|
|000049b0| 52 45 50 45 41 54 0d 09 | 09 61 57 69 6e 64 6f 77 |REPEAT..|.aWindow|
|000049c0| 20 3a 3d 20 46 72 6f 6e | 74 57 69 6e 64 6f 77 3b | := Fron|tWindow;|
|000049d0| 09 09 09 09 09 7b 67 65 | 74 20 74 68 65 20 63 75 |.....{ge|t the cu|
|000049e0| 72 72 65 6e 74 20 66 72 | 6f 6e 74 20 77 69 6e 64 |rrent fr|ont wind|
|000049f0| 6f 77 7d 0d 09 09 49 46 | 20 61 57 69 6e 64 6f 77 |ow}...IF| aWindow|
|00004a00| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 0d 09 09 09 | <> NIL |THEN....|
|00004a10| 63 6c 6f 73 65 64 20 3a | 3d 20 44 6f 43 6c 6f 73 |closed :|= DoClos|
|00004a20| 65 57 69 6e 64 6f 77 28 | 61 57 69 6e 64 6f 77 29 |eWindow(|aWindow)|
|00004a30| 3b 09 7b 63 6c 6f 73 65 | 20 74 68 69 73 20 77 69 |;.{close| this wi|
|00004a40| 6e 64 6f 77 7d 0d 09 55 | 4e 54 49 4c 20 28 4e 4f |ndow}..U|NTIL (NO|
|00004a50| 54 20 63 6c 6f 73 65 64 | 29 20 7c 20 28 61 57 69 |T closed|) | (aWi|
|00004a60| 6e 64 6f 77 20 3d 20 4e | 49 4c 29 3b 09 09 7b 64 |ndow = N|IL);..{d|
|00004a70| 6f 20 61 6c 6c 20 77 69 | 6e 64 6f 77 73 7d 0d 09 |o all wi|ndows}..|
|00004a80| 49 46 20 63 6c 6f 73 65 | 64 20 54 48 45 4e 0d 09 |IF close|d THEN..|
|00004a90| 09 45 78 69 74 54 6f 53 | 68 65 6c 6c 3b 09 09 09 |.ExitToS|hell;...|
|00004aa0| 09 09 09 09 7b 65 78 69 | 74 20 69 66 20 6e 6f 20 |....{exi|t if no |
|00004ab0| 63 61 6e 63 65 6c 6c 61 | 74 69 6f 6e 7d 0d 45 4e |cancella|tion}.EN|
|00004ac0| 44 3b 20 7b 54 65 72 6d | 69 6e 61 74 65 7d 0d 0d |D; {Term|inate}..|
|00004ad0| 0d 7b 24 53 20 4d 61 69 | 6e 7d 0d 50 52 4f 43 45 |.{$S Mai|n}.PROCE|
|00004ae0| 44 55 52 45 20 53 65 74 | 4c 69 67 68 74 28 77 69 |DURE Set|Light(wi|
|00004af0| 6e 64 6f 77 3a 20 57 69 | 6e 64 6f 77 50 74 72 3b |ndow: Wi|ndowPtr;|
|00004b00| 20 6e 65 77 53 74 6f 70 | 70 65 64 3a 20 42 4f 4f | newStop|ped: BOO|
|00004b10| 4c 45 41 4e 29 3b 0d 0d | 7b 43 68 61 6e 67 65 20 |LEAN);..|{Change |
|00004b20| 74 68 65 20 73 65 74 74 | 69 6e 67 20 6f 66 20 74 |the sett|ing of t|
|00004b30| 68 65 20 6c 69 67 68 74 | 2e 7d 0d 0d 42 45 47 49 |he light|.}..BEGI|
|00004b40| 4e 0d 09 49 46 20 6e 65 | 77 53 74 6f 70 70 65 64 |N..IF ne|wStopped|
|00004b50| 20 3c 3e 20 67 53 74 6f | 70 70 65 64 20 54 48 45 | <> gSto|pped THE|
|00004b60| 4e 20 42 45 47 49 4e 0d | 09 09 67 53 74 6f 70 70 |N BEGIN.|..gStopp|
|00004b70| 65 64 20 3a 3d 20 6e 65 | 77 53 74 6f 70 70 65 64 |ed := ne|wStopped|
|00004b80| 3b 0d 09 09 53 65 74 50 | 6f 72 74 28 77 69 6e 64 |;...SetP|ort(wind|
|00004b90| 6f 77 29 3b 0d 09 09 49 | 6e 76 61 6c 52 65 63 74 |ow);...I|nvalRect|
|00004ba0| 28 77 69 6e 64 6f 77 5e | 2e 70 6f 72 74 52 65 63 |(window^|.portRec|
|00004bb0| 74 29 3b 0d 09 45 4e 44 | 3b 0d 45 4e 44 3b 20 7b |t);..END|;.END; {|
|00004bc0| 53 65 74 4c 69 67 68 74 | 7d 0d 0d 0d 7b 24 53 20 |SetLight|}...{$S |
|00004bd0| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00004be0| 41 64 6a 75 73 74 4d 65 | 6e 75 73 3b 0d 0d 7b 45 |AdjustMe|nus;..{E|
|00004bf0| 6e 61 62 6c 65 20 61 6e | 64 20 64 69 73 61 62 6c |nable an|d disabl|
|00004c00| 65 20 6d 65 6e 75 73 20 | 62 61 73 65 64 20 6f 6e |e menus |based on|
|00004c10| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 73 74 61 | the cur|rent sta|
|00004c20| 74 65 2e 0d 20 54 68 65 | 20 75 73 65 72 20 63 61 |te.. The| user ca|
|00004c30| 6e 20 6f 6e 6c 79 20 73 | 65 6c 65 63 74 20 65 6e |n only s|elect en|
|00004c40| 61 62 6c 65 64 20 6d 65 | 6e 75 20 69 74 65 6d 73 |abled me|nu items|
|00004c50| 2e 20 57 65 20 73 65 74 | 20 75 70 20 61 6c 6c 20 |. We set| up all |
|00004c60| 74 68 65 20 6d 65 6e 75 | 20 69 74 65 6d 73 0d 20 |the menu| items. |
|00004c70| 62 65 66 6f 72 65 20 63 | 61 6c 6c 69 6e 67 20 4d |before c|alling M|
|00004c80| 65 6e 75 53 65 6c 65 63 | 74 20 6f 72 20 4d 65 6e |enuSelec|t or Men|
|00004c90| 75 4b 65 79 2c 20 73 69 | 6e 63 65 20 74 68 65 73 |uKey, si|nce thes|
|00004ca0| 65 20 61 72 65 20 74 68 | 65 20 6f 6e 6c 79 20 74 |e are th|e only t|
|00004cb0| 69 6d 65 73 20 74 68 61 | 74 0d 20 61 20 6d 65 6e |imes tha|t. a men|
|00004cc0| 75 20 69 74 65 6d 20 63 | 61 6e 20 62 65 20 73 65 |u item c|an be se|
|00004cd0| 6c 65 63 74 65 64 2e 20 | 4e 6f 74 65 20 74 68 61 |lected. |Note tha|
|00004ce0| 74 20 4d 65 6e 75 53 65 | 6c 65 63 74 20 69 73 20 |t MenuSe|lect is |
|00004cf0| 61 6c 73 6f 20 74 68 65 | 20 6f 6e 6c 79 20 74 69 |also the| only ti|
|00004d00| 6d 65 0d 20 74 68 65 20 | 75 73 65 72 20 77 69 6c |me. the |user wil|
|00004d10| 6c 20 73 65 65 20 6d 65 | 6e 75 20 69 74 65 6d 73 |l see me|nu items|
|00004d20| 2e 20 54 68 69 73 20 61 | 70 70 72 6f 61 63 68 20 |. This a|pproach |
|00004d30| 74 6f 20 64 65 63 69 64 | 69 6e 67 20 77 68 61 74 |to decid|ing what|
|00004d40| 20 65 6e 61 62 6c 65 2f | 0d 20 64 69 73 61 62 6c | enable/|. disabl|
|00004d50| 65 20 73 74 61 74 65 20 | 61 20 6d 65 6e 75 20 69 |e state |a menu i|
|00004d60| 74 65 6d 20 68 61 73 20 | 74 68 65 20 61 64 76 61 |tem has |the adva|
|00004d70| 6e 74 61 67 65 20 6f 66 | 20 63 6f 6e 63 65 6e 74 |ntage of| concent|
|00004d80| 72 61 74 69 6e 67 20 61 | 6c 6c 20 74 68 65 20 64 |rating a|ll the d|
|00004d90| 65 63 69 73 69 6f 6e 2d | 0d 20 6d 61 6b 69 6e 67 |ecision-|. making|
|00004da0| 20 69 6e 20 6f 6e 65 20 | 72 6f 75 74 69 6e 65 2c | in one |routine,|
|00004db0| 20 61 73 20 6f 70 70 6f | 73 65 64 20 74 6f 20 62 | as oppo|sed to b|
|00004dc0| 65 69 6e 67 20 73 70 72 | 65 61 64 20 74 68 72 6f |eing spr|ead thro|
|00004dd0| 75 67 68 6f 75 74 20 74 | 68 65 20 61 70 70 6c 69 |ughout t|he appli|
|00004de0| 63 61 74 69 6f 6e 2e 0d | 20 4f 74 68 65 72 20 61 |cation..| Other a|
|00004df0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 64 65 73 69 67 |pplicati|on desig|
|00004e00| 6e 73 20 6d 61 79 20 74 | 61 6b 65 20 61 20 64 69 |ns may t|ake a di|
|00004e10| 66 66 65 72 65 6e 74 20 | 61 70 70 72 6f 61 63 68 |fferent |approach|
|00004e20| 20 74 68 61 74 20 6d 61 | 79 20 6f 72 20 6d 61 79 | that ma|y or may|
|00004e30| 20 6e 6f 74 20 62 65 0d | 20 6a 75 73 74 20 61 73 | not be.| just as|
|00004e40| 20 76 61 6c 69 64 2e 7d | 0d 0d 56 41 52 0d 09 77 | valid.}|..VAR..w|
|00004e50| 69 6e 64 6f 77 09 09 09 | 3a 20 57 69 6e 64 6f 77 |indow...|: Window|
|00004e60| 50 74 72 3b 0d 09 6d 65 | 6e 75 09 09 09 3a 20 4d |Ptr;..me|nu...: M|
|00004e70| 65 6e 75 48 61 6e 64 6c | 65 3b 0d 0d 42 45 47 49 |enuHandl|e;..BEGI|
|00004e80| 4e 0d 09 77 69 6e 64 6f | 77 20 3a 3d 20 46 72 6f |N..windo|w := Fro|
|00004e90| 6e 74 57 69 6e 64 6f 77 | 3b 0d 0d 09 6d 65 6e 75 |ntWindow|;...menu|
|00004ea0| 20 3a 3d 20 47 65 74 4d | 48 61 6e 64 6c 65 28 6d | := GetM|Handle(m|
|00004eb0| 46 69 6c 65 29 3b 0d 09 | 49 46 20 49 73 44 41 57 |File);..|IF IsDAW|
|00004ec0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 54 48 |indow(wi|ndow) TH|
|00004ed0| 45 4e 09 09 09 09 7b 77 | 65 20 63 61 6e 20 61 6c |EN....{w|e can al|
|00004ee0| 6c 6f 77 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |low desk| accesso|
|00004ef0| 72 69 65 73 20 74 6f 20 | 62 65 20 63 6c 6f 73 65 |ries to |be close|
|00004f00| 64 20 66 72 6f 6d 20 74 | 68 65 20 6d 65 6e 75 7d |d from t|he menu}|
|00004f10| 0d 09 09 45 6e 61 62 6c | 65 49 74 65 6d 28 6d 65 |...Enabl|eItem(me|
|00004f20| 6e 75 2c 20 69 43 6c 6f | 73 65 29 0d 09 45 4c 53 |nu, iClo|se)..ELS|
|00004f30| 45 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |E...Disa|bleItem(|
|00004f40| 6d 65 6e 75 2c 20 69 43 | 6c 6f 73 65 29 3b 09 09 |menu, iC|lose);..|
|00004f50| 09 7b 62 75 74 20 6e 6f | 74 20 6f 75 72 20 74 72 |.{but no|t our tr|
|00004f60| 61 66 66 69 63 20 6c 69 | 67 68 74 20 77 69 6e 64 |affic li|ght wind|
|00004f70| 6f 77 7d 0d 0d 09 6d 65 | 6e 75 20 3a 3d 20 47 65 |ow}...me|nu := Ge|
|00004f80| 74 4d 48 61 6e 64 6c 65 | 28 6d 45 64 69 74 29 3b |tMHandle|(mEdit);|
|00004f90| 0d 09 49 46 20 49 73 44 | 41 57 69 6e 64 6f 77 28 |..IF IsD|AWindow(|
|00004fa0| 77 69 6e 64 6f 77 29 20 | 54 48 45 4e 20 42 45 47 |window) |THEN BEG|
|00004fb0| 49 4e 09 09 7b 61 20 64 | 65 73 6b 20 61 63 63 65 |IN..{a d|esk acce|
|00004fc0| 73 73 6f 72 79 20 6d 69 | 67 68 74 20 6e 65 65 64 |ssory mi|ght need|
|00004fd0| 20 74 68 65 20 65 64 69 | 74 20 6d 65 6e 75 7d 0d | the edi|t menu}.|
|00004fe0| 09 09 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |..Enable|Item(men|
|00004ff0| 75 2c 20 69 55 6e 64 6f | 29 3b 0d 09 09 45 6e 61 |u, iUndo|);...Ena|
|00005000| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00005010| 75 74 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |ut);...E|nableIte|
|00005020| 6d 28 6d 65 6e 75 2c 20 | 69 43 6f 70 79 29 3b 0d |m(menu, |iCopy);.|
|00005030| 09 09 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |..Enable|Item(men|
|00005040| 75 2c 20 69 50 61 73 74 | 65 29 3b 0d 09 09 45 6e |u, iPast|e);...En|
|00005050| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00005060| 43 6c 65 61 72 29 3b 0d | 09 45 4e 44 20 45 4c 53 |Clear);.|.END ELS|
|00005070| 45 20 42 45 47 49 4e 09 | 09 09 09 09 09 09 7b 62 |E BEGIN.|......{b|
|00005080| 75 74 20 77 65 20 6b 6e | 6f 77 20 77 65 20 64 6f |ut we kn|ow we do|
|00005090| 20 6e 6f 74 7d 0d 09 09 | 44 69 73 61 62 6c 65 49 | not}...|DisableI|
|000050a0| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 55 6e 64 6f 29 |tem(menu|, iUndo)|
|000050b0| 3b 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |;...Disa|bleItem(|
|000050c0| 6d 65 6e 75 2c 20 69 43 | 75 74 29 3b 0d 09 09 44 |menu, iC|ut);...D|
|000050d0| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|000050e0| 20 69 43 6f 70 79 29 3b | 0d 09 09 44 69 73 61 62 | iCopy);|...Disab|
|000050f0| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 43 6c |leItem(m|enu, iCl|
|00005100| 65 61 72 29 3b 0d 09 09 | 44 69 73 61 62 6c 65 49 |ear);...|DisableI|
|00005110| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 50 61 73 74 65 |tem(menu|, iPaste|
|00005120| 29 3b 0d 09 45 4e 44 3b | 0d 0d 09 6d 65 6e 75 20 |);..END;|...menu |
|00005130| 3a 3d 20 47 65 74 4d 48 | 61 6e 64 6c 65 28 6d 4c |:= GetMH|andle(mL|
|00005140| 69 67 68 74 29 3b 0d 09 | 49 46 20 49 73 41 70 70 |ight);..|IF IsApp|
|00005150| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 54 |Window(w|indow) T|
|00005160| 48 45 4e 20 42 45 47 49 | 4e 09 09 7b 77 65 20 6b |HEN BEGI|N..{we k|
|00005170| 6e 6f 77 20 74 68 61 74 | 20 69 74 20 6d 75 73 74 |now that| it must|
|00005180| 20 62 65 20 74 68 65 20 | 74 72 61 66 66 69 63 20 | be the |traffic |
|00005190| 6c 69 67 68 74 7d 0d 09 | 09 45 6e 61 62 6c 65 49 |light}..|.EnableI|
|000051a0| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 53 74 6f 70 29 |tem(menu|, iStop)|
|000051b0| 3b 0d 09 09 45 6e 61 62 | 6c 65 49 74 65 6d 28 6d |;...Enab|leItem(m|
|000051c0| 65 6e 75 2c 20 69 47 6f | 29 3b 0d 09 45 4e 44 20 |enu, iGo|);..END |
|000051d0| 45 4c 53 45 20 42 45 47 | 49 4e 0d 09 09 44 69 73 |ELSE BEG|IN...Dis|
|000051e0| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|000051f0| 53 74 6f 70 29 3b 0d 09 | 09 44 69 73 61 62 6c 65 |Stop);..|.Disable|
|00005200| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 47 6f 29 3b |Item(men|u, iGo);|
|00005210| 0d 09 45 4e 44 3b 0d 09 | 43 68 65 63 6b 49 74 65 |..END;..|CheckIte|
|00005220| 6d 28 6d 65 6e 75 2c 20 | 69 53 74 6f 70 2c 20 67 |m(menu, |iStop, g|
|00005230| 53 74 6f 70 70 65 64 29 | 3b 09 09 7b 77 65 20 63 |Stopped)|;..{we c|
|00005240| 61 6e 20 61 6c 73 6f 20 | 64 65 74 65 72 6d 69 6e |an also |determin|
|00005250| 65 20 63 68 65 63 6b 2f | 75 6e 63 68 65 63 6b 20 |e check/|uncheck |
|00005260| 73 74 61 74 65 2c 20 74 | 6f 6f 7d 0d 09 43 68 65 |state, t|oo}..Che|
|00005270| 63 6b 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 47 6f |ckItem(m|enu, iGo|
|00005280| 2c 20 4e 4f 54 20 67 53 | 74 6f 70 70 65 64 29 3b |, NOT gS|topped);|
|00005290| 0d 45 4e 44 3b 20 7b 41 | 64 6a 75 73 74 4d 65 6e |.END; {A|djustMen|
|000052a0| 75 73 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |us}...{$|S Main}.|
|000052b0| 50 52 4f 43 45 44 55 52 | 45 20 44 6f 4d 65 6e 75 |PROCEDUR|E DoMenu|
|000052c0| 43 6f 6d 6d 61 6e 64 28 | 6d 65 6e 75 52 65 73 75 |Command(|menuResu|
|000052d0| 6c 74 3a 20 4c 4f 4e 47 | 49 4e 54 29 3b 0d 0d 7b |lt: LONG|INT);..{|
|000052e0| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|000052f0| 68 65 6e 20 61 6e 20 69 | 74 65 6d 20 69 73 20 63 |hen an i|tem is c|
|00005300| 68 6f 73 65 6e 20 66 72 | 6f 6d 20 74 68 65 20 6d |hosen fr|om the m|
|00005310| 65 6e 75 20 62 61 72 20 | 28 61 66 74 65 72 20 63 |enu bar |(after c|
|00005320| 61 6c 6c 69 6e 67 0d 20 | 4d 65 6e 75 53 65 6c 65 |alling. |MenuSele|
|00005330| 63 74 20 6f 72 20 4d 65 | 6e 75 4b 65 79 29 2e 20 |ct or Me|nuKey). |
|00005340| 49 74 20 70 65 72 66 6f | 72 6d 73 20 74 68 65 20 |It perfo|rms the |
|00005350| 72 69 67 68 74 20 6f 70 | 65 72 61 74 69 6f 6e 20 |right op|eration |
|00005360| 66 6f 72 20 65 61 63 68 | 20 63 6f 6d 6d 61 6e 64 |for each| command|
|00005370| 2e 0d 20 49 74 20 69 73 | 20 67 6f 6f 64 20 74 6f |.. It is| good to|
|00005380| 20 68 61 76 65 20 62 6f | 74 68 20 74 68 65 20 72 | have bo|th the r|
|00005390| 65 73 75 6c 74 20 6f 66 | 20 4d 65 6e 75 53 65 6c |esult of| MenuSel|
|000053a0| 65 63 74 20 61 6e 64 20 | 4d 65 6e 75 4b 65 79 20 |ect and |MenuKey |
|000053b0| 67 6f 20 74 6f 0d 20 6f | 6e 65 20 72 6f 75 74 69 |go to. o|ne routi|
|000053c0| 6e 65 20 6c 69 6b 65 20 | 74 68 69 73 20 74 6f 20 |ne like |this to |
|000053d0| 6b 65 65 70 20 65 76 65 | 72 79 74 68 69 6e 67 20 |keep eve|rything |
|000053e0| 6f 72 67 61 6e 69 7a 65 | 64 2e 7d 0d 0d 56 41 52 |organize|d.}..VAR|
|000053f0| 0d 09 6d 65 6e 75 49 44 | 09 09 09 3a 20 49 4e 54 |..menuID|...: INT|
|00005400| 45 47 45 52 3b 09 09 7b | 74 68 65 20 72 65 73 6f |EGER;..{|the reso|
|00005410| 75 72 63 65 20 49 44 20 | 6f 66 20 74 68 65 20 73 |urce ID |of the s|
|00005420| 65 6c 65 63 74 65 64 20 | 6d 65 6e 75 7d 0d 09 6d |elected |menu}..m|
|00005430| 65 6e 75 49 74 65 6d 09 | 09 3a 20 49 4e 54 45 47 |enuItem.|.: INTEG|
|00005440| 45 52 3b 09 09 7b 74 68 | 65 20 69 74 65 6d 20 6e |ER;..{th|e item n|
|00005450| 75 6d 62 65 72 20 6f 66 | 20 74 68 65 20 73 65 6c |umber of| the sel|
|00005460| 65 63 74 65 64 20 6d 65 | 6e 75 7d 0d 09 69 74 65 |ected me|nu}..ite|
|00005470| 6d 48 69 74 09 09 09 3a | 20 49 4e 54 45 47 45 52 |mHit...:| INTEGER|
|00005480| 3b 0d 09 64 61 4e 61 6d | 65 09 09 09 3a 20 53 74 |;..daNam|e...: St|
|00005490| 72 32 35 35 3b 0d 09 64 | 61 52 65 66 4e 75 6d 09 |r255;..d|aRefNum.|
|000054a0| 09 3a 20 49 4e 54 45 47 | 45 52 3b 0d 09 68 61 6e |.: INTEG|ER;..han|
|000054b0| 64 6c 65 64 42 79 44 41 | 09 09 3a 20 42 4f 4f 4c |dledByDA|..: BOOL|
|000054c0| 45 41 4e 3b 0d 09 69 67 | 6e 6f 72 65 09 09 09 3a |EAN;..ig|nore...:|
|000054d0| 20 42 4f 4f 4c 45 41 4e | 3b 0d 0d 42 45 47 49 4e | BOOLEAN|;..BEGIN|
|000054e0| 0d 09 6d 65 6e 75 49 44 | 20 3a 3d 20 48 69 57 72 |..menuID| := HiWr|
|000054f0| 64 28 6d 65 6e 75 52 65 | 73 75 6c 74 29 3b 09 7b |d(menuRe|sult);.{|
|00005500| 75 73 65 20 62 75 69 6c | 74 2d 69 6e 73 20 28 66 |use buil|t-ins (f|
|00005510| 6f 72 20 65 66 66 69 63 | 69 65 6e 63 79 29 2e 2e |or effic|iency)..|
|00005520| 2e 7d 0d 09 6d 65 6e 75 | 49 74 65 6d 20 3a 3d 20 |.}..menu|Item := |
|00005530| 4c 6f 57 72 64 28 6d 65 | 6e 75 52 65 73 75 6c 74 |LoWrd(me|nuResult|
|00005540| 29 3b 09 7b 74 6f 20 67 | 65 74 20 6d 65 6e 75 20 |);.{to g|et menu |
|00005550| 69 74 65 6d 20 6e 75 6d | 62 65 72 20 61 6e 64 20 |item num|ber and |
|00005560| 6d 65 6e 75 20 6e 75 6d | 62 65 72 7d 0d 09 43 41 |menu num|ber}..CA|
|00005570| 53 45 20 6d 65 6e 75 49 | 44 20 4f 46 0d 09 09 6d |SE menuI|D OF...m|
|00005580| 41 70 70 6c 65 3a 0d 09 | 09 09 43 41 53 45 20 6d |Apple:..|..CASE m|
|00005590| 65 6e 75 49 74 65 6d 20 | 4f 46 0d 09 09 09 09 69 |enuItem |OF.....i|
|000055a0| 41 62 6f 75 74 3a 09 09 | 09 09 7b 62 72 69 6e 67 |About:..|..{bring|
|000055b0| 20 75 70 20 61 6c 65 72 | 74 20 66 6f 72 20 41 62 | up aler|t for Ab|
|000055c0| 6f 75 74 7d 0d 09 09 09 | 09 09 69 74 65 6d 48 69 |out}....|..itemHi|
|000055d0| 74 20 3a 3d 20 41 6c 65 | 72 74 28 72 41 62 6f 75 |t := Ale|rt(rAbou|
|000055e0| 74 41 6c 65 72 74 2c 20 | 4e 49 4c 29 3b 0d 09 09 |tAlert, |NIL);...|
|000055f0| 09 09 4f 54 48 45 52 57 | 49 53 45 20 42 45 47 49 |..OTHERW|ISE BEGI|
|00005600| 4e 09 09 7b 61 6c 6c 20 | 6e 6f 6e 2d 41 62 6f 75 |N..{all |non-Abou|
|00005610| 74 20 69 74 65 6d 73 20 | 69 6e 20 74 68 69 73 20 |t items |in this |
|00005620| 6d 65 6e 75 20 61 72 65 | 20 44 41 73 7d 0d 09 09 |menu are| DAs}...|
|00005630| 09 09 09 47 65 74 49 74 | 65 6d 28 47 65 74 4d 48 |...GetIt|em(GetMH|
|00005640| 61 6e 64 6c 65 28 6d 41 | 70 70 6c 65 29 2c 20 6d |andle(mA|pple), m|
|00005650| 65 6e 75 49 74 65 6d 2c | 20 64 61 4e 61 6d 65 29 |enuItem,| daName)|
|00005660| 3b 0d 09 09 09 09 09 64 | 61 52 65 66 4e 75 6d 20 |;......d|aRefNum |
|00005670| 3a 3d 20 4f 70 65 6e 44 | 65 73 6b 41 63 63 28 64 |:= OpenD|eskAcc(d|
|00005680| 61 4e 61 6d 65 29 3b 0d | 09 09 09 09 45 4e 44 3b |aName);.|....END;|
|00005690| 0d 09 09 09 45 4e 44 3b | 0d 09 09 6d 46 69 6c 65 |....END;|...mFile|
|000056a0| 3a 0d 09 09 09 43 41 53 | 45 20 6d 65 6e 75 49 74 |:....CAS|E menuIt|
|000056b0| 65 6d 20 4f 46 0d 09 09 | 09 09 69 43 6c 6f 73 65 |em OF...|..iClose|
|000056c0| 3a 0d 09 09 09 09 09 69 | 67 6e 6f 72 65 20 3a 3d |:......i|gnore :=|
|000056d0| 20 44 6f 43 6c 6f 73 65 | 57 69 6e 64 6f 77 28 46 | DoClose|Window(F|
|000056e0| 72 6f 6e 74 57 69 6e 64 | 6f 77 29 3b 20 7b 77 65 |rontWind|ow); {we|
|000056f0| 20 64 6f 6e 27 74 20 63 | 61 72 65 20 69 66 20 63 | don't c|are if c|
|00005700| 61 6e 63 65 6c 6c 65 64 | 7d 0d 09 09 09 09 69 51 |ancelled|}.....iQ|
|00005710| 75 69 74 3a 0d 09 09 09 | 09 09 54 65 72 6d 69 6e |uit:....|..Termin|
|00005720| 61 74 65 3b 0d 09 09 09 | 45 4e 44 3b 0d 09 09 6d |ate;....|END;...m|
|00005730| 45 64 69 74 3a 09 09 09 | 09 09 09 7b 63 61 6c 6c |Edit:...|...{call|
|00005740| 20 53 79 73 74 65 6d 45 | 64 69 74 20 66 6f 72 20 | SystemE|dit for |
|00005750| 44 41 20 65 64 69 74 69 | 6e 67 20 26 20 4d 75 6c |DA editi|ng & Mul|
|00005760| 74 69 46 69 6e 64 65 72 | 7d 0d 09 09 09 68 61 6e |tiFinder|}....han|
|00005770| 64 6c 65 64 42 79 44 41 | 20 3a 3d 20 53 79 73 74 |dledByDA| := Syst|
|00005780| 65 6d 45 64 69 74 28 6d | 65 6e 75 49 74 65 6d 2d |emEdit(m|enuItem-|
|00005790| 31 29 3b 09 7b 73 69 6e | 63 65 20 77 65 20 64 6f |1);.{sin|ce we do|
|000057a0| 6e 27 74 20 64 6f 20 61 | 6e 79 20 65 64 69 74 69 |n't do a|ny editi|
|000057b0| 6e 67 7d 0d 09 09 6d 4c | 69 67 68 74 3a 0d 09 09 |ng}...mL|ight:...|
|000057c0| 09 43 41 53 45 20 6d 65 | 6e 75 49 74 65 6d 20 4f |.CASE me|nuItem O|
|000057d0| 46 0d 09 09 09 09 69 53 | 74 6f 70 3a 0d 09 09 09 |F.....iS|top:....|
|000057e0| 09 09 53 65 74 4c 69 67 | 68 74 28 46 72 6f 6e 74 |..SetLig|ht(Front|
|000057f0| 57 69 6e 64 6f 77 2c 20 | 54 52 55 45 29 3b 0d 09 |Window, |TRUE);..|
|00005800| 09 09 09 69 47 6f 3a 0d | 09 09 09 09 09 53 65 74 |...iGo:.|.....Set|
|00005810| 4c 69 67 68 74 28 46 72 | 6f 6e 74 57 69 6e 64 6f |Light(Fr|ontWindo|
|00005820| 77 2c 20 46 41 4c 53 45 | 29 3b 0d 09 09 09 45 4e |w, FALSE|);....EN|
|00005830| 44 3b 0d 09 45 4e 44 3b | 0d 09 48 69 6c 69 74 65 |D;..END;|..Hilite|
|00005840| 4d 65 6e 75 28 30 29 3b | 09 09 09 09 09 7b 75 6e |Menu(0);|.....{un|
|00005850| 68 69 67 68 6c 69 67 68 | 74 20 77 68 61 74 20 4d |highligh|t what M|
|00005860| 65 6e 75 53 65 6c 65 63 | 74 20 28 6f 72 20 4d 65 |enuSelec|t (or Me|
|00005870| 6e 75 4b 65 79 29 20 68 | 69 6c 69 74 65 64 7d 0d |nuKey) h|ilited}.|
|00005880| 45 4e 44 3b 20 7b 44 6f | 4d 65 6e 75 43 6f 6d 6d |END; {Do|MenuComm|
|00005890| 61 6e 64 7d 0d 0d 0d 7b | 24 53 20 4d 61 69 6e 7d |and}...{|$S Main}|
|000058a0| 0d 50 52 4f 43 45 44 55 | 52 45 20 44 72 61 77 57 |.PROCEDU|RE DrawW|
|000058b0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 3a 20 57 69 |indow(wi|ndow: Wi|
|000058c0| 6e 64 6f 77 50 74 72 29 | 3b 0d 0d 7b 44 72 61 77 |ndowPtr)|;..{Draw|
|000058d0| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 73 20 6f 66 | the con|tents of|
|000058e0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000058f0| 20 77 69 6e 64 6f 77 2e | 20 57 65 20 64 6f 20 73 | window.| We do s|
|00005900| 6f 6d 65 20 64 72 61 77 | 69 6e 67 20 69 6e 20 63 |ome draw|ing in c|
|00005910| 6f 6c 6f 72 2c 20 75 73 | 69 6e 67 0d 20 43 6c 61 |olor, us|ing. Cla|
|00005920| 73 73 69 63 20 51 75 69 | 63 6b 44 72 61 77 27 73 |ssic Qui|ckDraw's|
|00005930| 20 63 6f 6c 6f 72 20 63 | 61 70 61 62 69 6c 69 74 | color c|apabilit|
|00005940| 69 65 73 2e 20 54 68 69 | 73 20 77 69 6c 6c 20 62 |ies. Thi|s will b|
|00005950| 65 20 62 6c 61 63 6b 20 | 61 6e 64 20 77 68 69 74 |e black |and whit|
|00005960| 65 20 6f 6e 20 6f 6c 64 | 0d 20 6d 61 63 68 69 6e |e on old|. machin|
|00005970| 65 73 2c 20 62 75 74 20 | 63 6f 6c 6f 72 20 6f 6e |es, but |color on|
|00005980| 20 63 6f 6c 6f 72 20 6d | 61 63 68 69 6e 65 73 2e | color m|achines.|
|00005990| 20 41 74 20 74 68 69 73 | 20 70 6f 69 6e 74 2c 20 | At this| point, |
|000059a0| 74 68 65 20 77 69 6e 64 | 6f 77 27 73 20 76 69 73 |the wind|ow's vis|
|000059b0| 52 67 6e 20 69 73 0d 20 | 73 65 74 20 74 6f 20 61 |Rgn is. |set to a|
|000059c0| 6c 6c 6f 77 20 64 72 61 | 77 69 6e 67 20 6f 6e 6c |llow dra|wing onl|
|000059d0| 79 20 77 68 65 72 65 20 | 69 74 20 6e 65 65 64 73 |y where |it needs|
|000059e0| 20 74 6f 20 62 65 20 64 | 6f 6e 65 2e 7d 0d 0d 42 | to be d|one.}..B|
|000059f0| 45 47 49 4e 0d 09 53 65 | 74 50 6f 72 74 28 77 69 |EGIN..Se|tPort(wi|
|00005a00| 6e 64 6f 77 29 3b 0d 0d | 09 45 72 61 73 65 52 65 |ndow);..|.EraseRe|
|00005a10| 63 74 28 77 69 6e 64 6f | 77 5e 2e 70 6f 72 74 52 |ct(windo|w^.portR|
|00005a20| 65 63 74 29 3b 09 7b 63 | 6c 65 61 72 20 6f 75 74 |ect);.{c|lear out|
|00005a30| 20 61 6e 79 20 67 61 72 | 62 61 67 65 20 74 68 61 | any gar|bage tha|
|00005a40| 74 20 6d 69 67 68 74 20 | 62 65 20 6c 65 66 74 20 |t might |be left |
|00005a50| 62 65 68 69 6e 64 7d 0d | 09 49 46 20 67 53 74 6f |behind}.|.IF gSto|
|00005a60| 70 70 65 64 20 54 48 45 | 4e 09 09 09 09 7b 64 72 |pped THE|N....{dr|
|00005a70| 61 77 20 61 20 72 65 64 | 20 28 6f 72 20 77 68 69 |aw a red| (or whi|
|00005a80| 74 65 29 20 73 74 6f 70 | 20 6c 69 67 68 74 7d 0d |te) stop| light}.|
|00005a90| 09 09 46 6f 72 65 43 6f | 6c 6f 72 28 72 65 64 43 |..ForeCo|lor(redC|
|00005aa0| 6f 6c 6f 72 29 0d 09 45 | 4c 53 45 0d 09 09 46 6f |olor)..E|LSE...Fo|
|00005ab0| 72 65 43 6f 6c 6f 72 28 | 77 68 69 74 65 43 6f 6c |reColor(|whiteCol|
|00005ac0| 6f 72 29 3b 0d 09 50 61 | 69 6e 74 4f 76 61 6c 28 |or);..Pa|intOval(|
|00005ad0| 67 53 74 6f 70 52 65 63 | 74 29 3b 0d 09 46 6f 72 |gStopRec|t);..For|
|00005ae0| 65 43 6f 6c 6f 72 28 62 | 6c 61 63 6b 43 6f 6c 6f |eColor(b|lackColo|
|00005af0| 72 29 3b 0d 09 46 72 61 | 6d 65 4f 76 61 6c 28 67 |r);..Fra|meOval(g|
|00005b00| 53 74 6f 70 52 65 63 74 | 29 3b 0d 09 49 46 20 4e |StopRect|);..IF N|
|00005b10| 4f 54 20 67 53 74 6f 70 | 70 65 64 20 54 48 45 4e |OT gStop|ped THEN|
|00005b20| 09 09 09 7b 64 72 61 77 | 20 61 20 67 72 65 65 6e |...{draw| a green|
|00005b30| 20 28 6f 72 20 77 68 69 | 74 65 29 20 67 6f 20 6c | (or whi|te) go l|
|00005b40| 69 67 68 74 7d 0d 09 09 | 46 6f 72 65 43 6f 6c 6f |ight}...|ForeColo|
|00005b50| 72 28 67 72 65 65 6e 43 | 6f 6c 6f 72 29 0d 09 45 |r(greenC|olor)..E|
|00005b60| 4c 53 45 0d 09 09 46 6f | 72 65 43 6f 6c 6f 72 28 |LSE...Fo|reColor(|
|00005b70| 77 68 69 74 65 43 6f 6c | 6f 72 29 3b 0d 09 50 61 |whiteCol|or);..Pa|
|00005b80| 69 6e 74 4f 76 61 6c 28 | 67 47 6f 52 65 63 74 29 |intOval(|gGoRect)|
|00005b90| 3b 0d 09 46 6f 72 65 43 | 6f 6c 6f 72 28 62 6c 61 |;..ForeC|olor(bla|
|00005ba0| 63 6b 43 6f 6c 6f 72 29 | 3b 0d 09 46 72 61 6d 65 |ckColor)|;..Frame|
|00005bb0| 4f 76 61 6c 28 67 47 6f | 52 65 63 74 29 3b 0d 45 |Oval(gGo|Rect);.E|
|00005bc0| 4e 44 3b 20 7b 44 72 61 | 77 57 69 6e 64 6f 77 7d |ND; {Dra|wWindow}|
|00005bd0| 0d 0d 0d 7b 24 53 20 4d | 61 69 6e 7d 0d 50 52 4f |...{$S M|ain}.PRO|
|00005be0| 43 45 44 55 52 45 20 44 | 6f 43 6f 6e 74 65 6e 74 |CEDURE D|oContent|
|00005bf0| 43 6c 69 63 6b 28 77 69 | 6e 64 6f 77 3a 20 57 69 |Click(wi|ndow: Wi|
|00005c00| 6e 64 6f 77 50 74 72 3b | 20 65 76 65 6e 74 3a 20 |ndowPtr;| event: |
|00005c10| 45 76 65 6e 74 52 65 63 | 6f 72 64 29 3b 0d 0d 7b |EventRec|ord);..{|
|00005c20| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|00005c30| 68 65 6e 20 61 20 6d 6f | 75 73 65 2d 64 6f 77 6e |hen a mo|use-down|
|00005c40| 20 65 76 65 6e 74 20 6f | 63 63 75 72 73 20 69 6e | event o|ccurs in|
|00005c50| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 20 6f 66 20 | the con|tent of |
|00005c60| 61 20 77 69 6e 64 6f 77 | 2e 0d 20 4f 74 68 65 72 |a window|.. Other|
|00005c70| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 6d 69 | applica|tions mi|
|00005c80| 67 68 74 20 77 61 6e 74 | 20 74 6f 20 63 61 6c 6c |ght want| to call|
|00005c90| 20 46 69 6e 64 43 6f 6e | 74 72 6f 6c 2c 20 54 45 | FindCon|trol, TE|
|00005ca0| 43 6c 69 63 6b 2c 20 65 | 74 63 2e 2c 20 74 6f 0d |Click, e|tc., to.|
|00005cb0| 20 66 75 72 74 68 65 72 | 20 70 72 6f 63 65 73 73 | further| process|
|00005cc0| 20 74 68 65 20 63 6c 69 | 63 6b 2e 7d 0d 0d 42 45 | the cli|ck.}..BE|
|00005cd0| 47 49 4e 0d 09 53 65 74 | 4c 69 67 68 74 28 77 69 |GIN..Set|Light(wi|
|00005ce0| 6e 64 6f 77 2c 20 4e 4f | 54 20 67 53 74 6f 70 70 |ndow, NO|T gStopp|
|00005cf0| 65 64 29 3b 0d 45 4e 44 | 3b 20 7b 44 6f 43 6f 6e |ed);.END|; {DoCon|
|00005d00| 74 65 6e 74 43 6c 69 63 | 6b 7d 0d 0d 0d 7b 24 53 |tentClic|k}...{$S|
|00005d10| 20 4d 61 69 6e 7d 0d 50 | 52 4f 43 45 44 55 52 45 | Main}.P|ROCEDURE|
|00005d20| 20 44 6f 55 70 64 61 74 | 65 28 77 69 6e 64 6f 77 | DoUpdat|e(window|
|00005d30| 3a 20 57 69 6e 64 6f 77 | 50 74 72 29 3b 0d 0d 7b |: Window|Ptr);..{|
|00005d40| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|00005d50| 68 65 6e 20 61 6e 20 75 | 70 64 61 74 65 20 65 76 |hen an u|pdate ev|
|00005d60| 65 6e 74 20 69 73 20 72 | 65 63 65 69 76 65 64 20 |ent is r|eceived |
|00005d70| 66 6f 72 20 61 20 77 69 | 6e 64 6f 77 2e 0d 20 49 |for a wi|ndow.. I|
|00005d80| 74 20 63 61 6c 6c 73 20 | 44 72 61 77 57 69 6e 64 |t calls |DrawWind|
|00005d90| 6f 77 20 74 6f 20 64 72 | 61 77 20 74 68 65 20 63 |ow to dr|aw the c|
|00005da0| 6f 6e 74 65 6e 74 73 20 | 6f 66 20 61 6e 20 61 70 |ontents |of an ap|
|00005db0| 70 6c 69 63 61 74 69 6f | 6e 20 77 69 6e 64 6f 77 |plicatio|n window|
|00005dc0| 2e 0d 20 41 73 20 61 6e | 20 65 66 66 65 63 69 65 |.. As an| effecie|
|00005dd0| 6e 63 79 20 6d 65 61 73 | 75 72 65 20 74 68 61 74 |ncy meas|ure that|
|00005de0| 20 64 6f 65 73 20 6e 6f | 74 20 68 61 76 65 20 74 | does no|t have t|
|00005df0| 6f 20 62 65 20 66 6f 6c | 6c 6f 77 65 64 2c 20 69 |o be fol|lowed, i|
|00005e00| 74 0d 20 63 61 6c 6c 73 | 20 74 68 65 20 64 72 61 |t. calls| the dra|
|00005e10| 77 69 6e 67 20 72 6f 75 | 74 69 6e 65 20 6f 6e 6c |wing rou|tine onl|
|00005e20| 79 20 69 66 20 74 68 65 | 20 76 69 73 52 67 6e 20 |y if the| visRgn |
|00005e30| 69 73 20 6e 6f 6e 2d 65 | 6d 70 74 79 2e 20 54 68 |is non-e|mpty. Th|
|00005e40| 69 73 0d 20 77 69 6c 6c | 20 68 61 6e 64 6c 65 20 |is. will| handle |
|00005e50| 73 69 74 75 61 74 69 6f | 6e 73 20 77 68 65 72 65 |situatio|ns where|
|00005e60| 20 63 61 6c 63 75 6c 61 | 74 69 6f 6e 73 20 66 6f | calcula|tions fo|
|00005e70| 72 20 64 72 61 77 69 6e | 67 20 6f 72 20 64 72 61 |r drawin|g or dra|
|00005e80| 77 69 6e 67 0d 20 69 74 | 73 65 6c 66 20 69 73 20 |wing. it|self is |
|00005e90| 76 65 72 79 20 74 69 6d | 65 2d 63 6f 6e 73 75 6d |very tim|e-consum|
|00005ea0| 69 6e 67 2e 7d 0d 0d 42 | 45 47 49 4e 0d 09 49 46 |ing.}..B|EGIN..IF|
|00005eb0| 20 49 73 41 70 70 57 69 | 6e 64 6f 77 28 77 69 6e | IsAppWi|ndow(win|
|00005ec0| 64 6f 77 29 20 54 48 45 | 4e 20 42 45 47 49 4e 0d |dow) THE|N BEGIN.|
|00005ed0| 09 09 42 65 67 69 6e 55 | 70 64 61 74 65 28 77 69 |..BeginU|pdate(wi|
|00005ee0| 6e 64 6f 77 29 3b 09 09 | 09 09 09 7b 73 65 74 73 |ndow);..|...{sets|
|00005ef0| 20 75 70 20 74 68 65 20 | 76 69 73 52 67 6e 2c 20 | up the |visRgn, |
|00005f00| 63 6c 65 61 72 73 20 75 | 70 64 61 74 65 52 67 6e |clears u|pdateRgn|
|00005f10| 7d 0d 09 09 49 46 20 4e | 4f 54 20 45 6d 70 74 79 |}...IF N|OT Empty|
|00005f20| 52 67 6e 28 77 69 6e 64 | 6f 77 5e 2e 76 69 73 52 |Rgn(wind|ow^.visR|
|00005f30| 67 6e 29 20 54 48 45 4e | 09 7b 64 72 61 77 20 69 |gn) THEN|.{draw i|
|00005f40| 66 20 75 70 64 61 74 69 | 6e 67 20 6e 65 65 64 73 |f updati|ng needs|
|00005f50| 20 74 6f 20 62 65 20 64 | 6f 6e 65 7d 0d 09 09 09 | to be d|one}....|
|00005f60| 44 72 61 77 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |DrawWind|ow(windo|
|00005f70| 77 29 3b 0d 09 09 45 6e | 64 55 70 64 61 74 65 28 |w);...En|dUpdate(|
|00005f80| 77 69 6e 64 6f 77 29 3b | 09 09 09 09 09 09 7b 72 |window);|......{r|
|00005f90| 65 73 74 6f 72 65 73 20 | 74 68 65 20 76 69 73 52 |estores |the visR|
|00005fa0| 67 6e 7d 0d 09 45 4e 44 | 3b 0d 45 4e 44 3b 20 7b |gn}..END|;.END; {|
|00005fb0| 44 6f 55 70 64 61 74 65 | 7d 0d 0d 0d 7b 24 53 20 |DoUpdate|}...{$S |
|00005fc0| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00005fd0| 44 6f 41 63 74 69 76 61 | 74 65 28 77 69 6e 64 6f |DoActiva|te(windo|
|00005fe0| 77 3a 20 57 69 6e 64 6f | 77 50 74 72 3b 20 62 65 |w: Windo|wPtr; be|
|00005ff0| 63 6f 6d 69 6e 67 41 63 | 74 69 76 65 3a 20 42 4f |comingAc|tive: BO|
|00006000| 4f 4c 45 41 4e 29 3b 0d | 0d 7b 54 68 69 73 20 69 |OLEAN);.|.{This i|
|00006010| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 20 |s called| when a |
|00006020| 77 69 6e 64 6f 77 20 69 | 73 20 61 63 74 69 76 61 |window i|s activa|
|00006030| 74 65 64 20 6f 72 20 64 | 65 61 63 74 69 76 61 74 |ted or d|eactivat|
|00006040| 65 64 2e 0d 20 49 6e 20 | 53 61 6d 70 6c 65 2c 20 |ed.. In |Sample, |
|00006050| 74 68 65 20 57 69 6e 64 | 6f 77 20 4d 61 6e 61 67 |the Wind|ow Manag|
|00006060| 65 72 27 73 20 68 61 6e | 64 6c 69 6e 67 20 6f 66 |er's han|dling of|
|00006070| 20 61 63 74 69 76 61 74 | 65 20 61 6e 64 0d 20 64 | activat|e and. d|
|00006080| 65 61 63 74 69 76 61 74 | 65 20 65 76 65 6e 74 73 |eactivat|e events|
|00006090| 20 69 73 20 73 75 66 66 | 69 63 69 65 6e 74 2e 20 | is suff|icient. |
|000060a0| 4f 74 68 65 72 20 61 70 | 70 6c 69 63 61 74 69 6f |Other ap|plicatio|
|000060b0| 6e 73 20 6d 61 79 20 68 | 61 76 65 0d 20 54 65 78 |ns may h|ave. Tex|
|000060c0| 74 45 64 69 74 20 72 65 | 63 6f 72 64 73 2c 20 63 |tEdit re|cords, c|
|000060d0| 6f 6e 74 72 6f 6c 73 2c | 20 6c 69 73 74 73 2c 20 |ontrols,| lists, |
|000060e0| 65 74 63 2e 2c 20 74 6f | 20 61 63 74 69 76 61 74 |etc., to| activat|
|000060f0| 65 2f 64 65 61 63 74 69 | 76 61 74 65 2e 7d 0d 0d |e/deacti|vate.}..|
|00006100| 42 45 47 49 4e 0d 09 49 | 46 20 49 73 41 70 70 57 |BEGIN..I|F IsAppW|
|00006110| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 54 48 |indow(wi|ndow) TH|
|00006120| 45 4e 0d 09 09 49 46 20 | 62 65 63 6f 6d 69 6e 67 |EN...IF |becoming|
|00006130| 41 63 74 69 76 65 20 54 | 48 45 4e 0d 09 09 09 7b |Active T|HEN....{|
|00006140| 64 6f 20 77 68 61 74 65 | 76 65 72 20 79 6f 75 20 |do whate|ver you |
|00006150| 6e 65 65 64 20 74 6f 20 | 61 74 20 61 63 74 69 76 |need to |at activ|
|00006160| 61 74 69 6f 6e 7d 0d 09 | 09 45 4c 53 45 0d 09 09 |ation}..|.ELSE...|
|00006170| 09 7b 64 6f 20 77 68 61 | 74 65 76 65 72 20 79 6f |.{do wha|tever yo|
|00006180| 75 20 6e 65 65 64 20 74 | 6f 20 61 74 20 64 65 61 |u need t|o at dea|
|00006190| 63 74 69 76 61 74 69 6f | 6e 7d 3b 0d 45 4e 44 3b |ctivatio|n};.END;|
|000061a0| 20 7b 44 6f 41 63 74 69 | 76 61 74 65 7d 0d 0d 0d | {DoActi|vate}...|
|000061b0| 7b 24 53 20 4d 61 69 6e | 7d 0d 50 52 4f 43 45 44 |{$S Main|}.PROCED|
|000061c0| 55 52 45 20 41 64 6a 75 | 73 74 43 75 72 73 6f 72 |URE Adju|stCursor|
|000061d0| 28 6d 6f 75 73 65 3a 20 | 50 6f 69 6e 74 3b 20 72 |(mouse: |Point; r|
|000061e0| 65 67 69 6f 6e 3a 20 52 | 67 6e 48 61 6e 64 6c 65 |egion: R|gnHandle|
|000061f0| 29 3b 0d 0d 7b 43 68 61 | 6e 67 65 20 74 68 65 20 |);..{Cha|nge the |
|00006200| 63 75 72 73 6f 72 27 73 | 20 73 68 61 70 65 2c 20 |cursor's| shape, |
|00006210| 64 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 69 74 73 |dependin|g on its|
|00006220| 20 70 6f 73 69 74 69 6f | 6e 2e 20 54 68 69 73 20 | positio|n. This |
|00006230| 61 6c 73 6f 20 63 61 6c | 63 75 6c 61 74 65 73 20 |also cal|culates |
|00006240| 74 68 65 20 72 65 67 69 | 6f 6e 0d 20 77 68 65 72 |the regi|on. wher|
|00006250| 65 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 63 75 |e the cu|rrent cu|
|00006260| 72 73 6f 72 20 72 65 73 | 69 64 65 73 20 28 66 6f |rsor res|ides (fo|
|00006270| 72 20 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 29 |r WaitNe|xtEvent)|
|00006280| 2e 20 49 66 20 74 68 65 | 20 6d 6f 75 73 65 20 69 |. If the| mouse i|
|00006290| 73 20 65 76 65 72 20 6f | 75 74 73 69 64 65 20 6f |s ever o|utside o|
|000062a0| 66 0d 20 74 68 61 74 20 | 72 65 67 69 6f 6e 2c 20 |f. that |region, |
|000062b0| 61 6e 20 65 76 65 6e 74 | 20 69 73 20 67 65 6e 65 |an event| is gene|
|000062c0| 72 61 74 65 64 2c 20 63 | 61 75 73 69 6e 67 20 74 |rated, c|ausing t|
|000062d0| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 74 6f 20 62 |his rout|ine to b|
|000062e0| 65 20 63 61 6c 6c 65 64 | 2e 20 54 68 69 73 0d 20 |e called|. This. |
|000062f0| 61 6c 6c 6f 77 73 20 75 | 73 20 74 6f 20 63 68 61 |allows u|s to cha|
|00006300| 6e 67 65 20 74 68 65 20 | 72 65 67 69 6f 6e 20 74 |nge the |region t|
|00006310| 6f 20 74 68 65 20 72 65 | 67 69 6f 6e 20 74 68 65 |o the re|gion the|
|00006320| 20 6d 6f 75 73 65 20 69 | 73 20 63 75 72 72 65 6e | mouse i|s curren|
|00006330| 74 6c 79 20 69 6e 2e 20 | 49 66 0d 20 74 68 65 72 |tly in. |If. ther|
|00006340| 65 20 69 73 20 6d 6f 72 | 65 20 74 6f 20 74 68 65 |e is mor|e to the|
|00006350| 20 65 76 65 6e 74 20 74 | 68 61 6e 20 6a 75 73 74 | event t|han just|
|00006360| 20 d2 74 68 65 20 6d 6f | 75 73 65 20 6d 6f 76 65 | .the mo|use move|
|00006370| 64 d3 2c 20 77 65 20 67 | 65 74 20 63 61 6c 6c 65 |d., we g|et calle|
|00006380| 64 20 62 65 66 6f 72 65 | 20 74 68 65 0d 20 65 76 |d before| the. ev|
|00006390| 65 6e 74 20 69 73 20 70 | 72 6f 63 65 73 73 65 64 |ent is p|rocessed|
|000063a0| 20 74 6f 20 6d 61 6b 65 | 20 73 75 72 65 20 74 68 | to make| sure th|
|000063b0| 65 20 63 75 72 73 6f 72 | 20 69 73 20 74 68 65 20 |e cursor| is the |
|000063c0| 72 69 67 68 74 20 6f 6e | 65 2e 20 49 6e 20 61 6e |right on|e. In an|
|000063d0| 79 20 28 61 68 65 6d 29 | 20 65 76 65 6e 74 2c 0d |y (ahem)| event,.|
|000063e0| 20 74 68 69 73 20 69 73 | 20 63 61 6c 6c 65 64 20 | this is| called |
|000063f0| 61 67 61 69 6e 20 62 65 | 66 6f 72 65 20 77 65 20 |again be|fore we |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.